public void AddObject(WorldObject obj) { WorldObjects.Add(obj); if (obj is IPlayer) Player = (IPlayer)obj; if (obj is IDynamicObject) DynamicObjects.Add((IDynamicObject)obj); }
private bool isWithinSight(WorldObject worldObject, float sightRadiusSq) { return Math.Pow(worldObject.Position.X - _position.X, 2) + Math.Pow(worldObject.Position.Y - _position.Y, 2) < sightRadiusSq; }
/// <summary> /// Safely Destroy Even in ForEach /// </summary> /// <param name="obj"></param> public void SafelyRemoveObject(WorldObject obj) { _removalList.Add(obj); }
void goodRoid_Destroyed(WorldObject obj) { PlayerProfile.CurrentGoodNumber -= 1; if (PlayerProfile.CurrentGoodNumber == (PlayerProfile.RoidsToNotBlast - 3)) Death(); }
void badRoid_Destroyed(WorldObject obj) { PlayerProfile.RoidsToBlast -= 1; if (PlayerProfile.RoidsToBlast == 0) EndGame(); else this.Write("Roids to Blast: {0}", PlayerProfile.RoidsToBlast); }