X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=CarFire%2FCarFire%2FCarFire%2FSaberMonster.cs;h=a3507c87f6006642655594aaa009555cbc283f1c;hb=60d05271b295d2ca94a0028059add525c1bbffb1;hp=c2932eed05f96802579e167bc08da82dc121b0e6;hpb=7ffb03574d79049fc13fc08412b4f62ad309874d;p=chaz%2Fcarfire diff --git a/CarFire/CarFire/CarFire/SaberMonster.cs b/CarFire/CarFire/CarFire/SaberMonster.cs index c2932ee..a3507c8 100644 --- a/CarFire/CarFire/CarFire/SaberMonster.cs +++ b/CarFire/CarFire/CarFire/SaberMonster.cs @@ -28,6 +28,8 @@ namespace CarFire /// public class SaberMonster : IMonster { + //starting health + int health = 100; /// /// Construct this type of monster. This constructor is called /// by the map when the game requests entities. @@ -100,8 +102,12 @@ namespace CarFire PathFinder pathFinder = new PathFinder(mGame.Grid); mPath = new List(32); mPath.Add(Coordinates); - mPath.AddRange(pathFinder.GetPath(mMotion.Coordinates, mIdlePath[mIdlePathIndex])); - mPath.Add(mIdlePath[mIdlePathIndex]); + List path = pathFinder.GetPath(mMotion.Coordinates, mIdlePath[mIdlePathIndex]); + if (path != null) + { + mPath.AddRange(path); + mPath.Add(mIdlePath[mIdlePathIndex]); + } mPathIndex = 0; } @@ -115,8 +121,12 @@ namespace CarFire PathFinder pathFinder = new PathFinder(mGame.Grid); mPath = new List(32); mPath.Add(Coordinates); - mPath.AddRange(pathFinder.GetPath(mMotion.Coordinates, mIdlePath[mIdlePathIndex % mIdlePath.Count])); - mPath.Add(mIdlePath[mIdlePathIndex % mIdlePath.Count]); + List path = pathFinder.GetPath(mMotion.Coordinates, mIdlePath[mIdlePathIndex % mIdlePath.Count]); + if (path != null) + { + mPath.AddRange(path); + mPath.Add(mIdlePath[mIdlePathIndex % mIdlePath.Count]); + } mPathIndex = 0; } @@ -188,7 +198,8 @@ namespace CarFire /// public int Health { - get { throw new NotImplementedException(); } + get { return this.health; } + } /// @@ -197,9 +208,11 @@ namespace CarFire /// public void causeDamageTo(int amount) { - throw new NotImplementedException(); + this.health -= amount; } + public bool IsCollidable { get { return true; } } + /// /// Get the smoothed position. ///