2014-04-23 14:28:13 -07:00
|
|
|
package server
|
2013-10-20 20:54:19 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
v "bitbucket.org/hackerbots/vector"
|
|
|
|
)
|
|
|
|
|
2014-04-14 00:26:41 -07:00
|
|
|
// Splosion embodies an explosion.
|
2013-10-20 20:54:19 -07:00
|
|
|
type Splosion struct {
|
2013-11-09 21:46:49 -08:00
|
|
|
Id string `json:"id"`
|
|
|
|
Position v.Point2d `json:"position"`
|
|
|
|
Radius int `json:"radius"`
|
|
|
|
Lifespan int `json:"-"`
|
2013-10-20 20:54:19 -07:00
|
|
|
}
|
|
|
|
|
2014-04-14 00:26:41 -07:00
|
|
|
// Tick decrements the lifespan of said Splosion.
|
2013-10-20 20:54:19 -07:00
|
|
|
func (s *Splosion) Tick() {
|
|
|
|
s.Lifespan--
|
|
|
|
}
|
|
|
|
|
2014-04-14 00:26:41 -07:00
|
|
|
// Alive determines if this Splosion is still relevant.
|
2013-10-20 20:54:19 -07:00
|
|
|
func (s *Splosion) Alive() bool {
|
|
|
|
return s.Lifespan > 0
|
|
|
|
}
|