public static void Main(string[] args) { Noun zPlayer = new Player(); MyNouns.Add(zPlayer); var zObj = new Thing(); ScreenCell2D loc = new ScreenCell2D(10, 5); zObj.GoTo(loc); MyNouns.Add(zObj); MyNouns.Add(new Alien()); DoInit(MyNouns); ObjectStatus status = new ObjectStatus(); while (status.state != ObjectStatus.ActiveState.Dead) { foreach (IMovable item in MyNouns) { item.OnMove(); item.OnDraw(); } zPlayer.GetStatus(ref status); } DoDeInit(MyNouns); }
public override void OnMove() { if (calc.Next(this.speed, out ScreenCell2D next)) { calc.Plot(this.playerPoint, ScreenCell2D.GetRandomPoint()); } playerPoint = next; }
internal static Boolean CheckLocation(ScreenCell2D location, List <IMovable> results) { bool bGots = false; foreach (var mover in MyNouns) { if (mover.GetLocation().Equals(location)) { bGots = true; results.Add(mover); } } return(bGots); }