protected override void OnUpdate() { // Gewinnbedingung if (Engine.Round >= 4800 && Mode == LevelMode.Running) { Faction winner = null; foreach (var faction in Factions) { if (faction == null) { continue; } if (winner == null) { winner = faction; } } if (winner != null) { FinishPlayer(winner.SlotIndex); } else { Draw(); } } Index2 cells = Engine.Map.GetCellCount(); if (sugar == null) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); sugar = new SugarItem(Context, pos, 1000); Engine.InsertItem(sugar); } if (apple == null) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); apple = new AppleItem(Context, pos, 250); Engine.InsertItem(apple); } if (bugs.Count < 3) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); Angle orientation = Angle.FromDegree(Random.Next(0, 359)); ClassicBugItem bug = new ClassicBugItem(Context, pos, orientation); bugs.Add(bug); Engine.InsertItem(bug); } }
public BugInfo(ClassicBugItem item, Item observer) : base(item, observer) { }
protected override void OnUpdate() { // Gewinnbedingung if (Engine.Round >= 4800 && Mode == LevelMode.Running) { Faction winner = null; foreach (var faction in Factions) { if (faction == null) continue; if (winner == null) { winner = faction; } } if (winner != null) FinishPlayer(winner.SlotIndex); else Draw(); } Index2 cells = Engine.Map.GetCellCount(); if (sugar == null) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); sugar = new SugarItem(Context, pos, 1000); Engine.InsertItem(sugar); } if (apple == null) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); apple = new AppleItem(Context, pos, 250); Engine.InsertItem(apple); } if (bugs.Count < 3) { Vector2 pos = new Vector2( ((float)Random.NextDouble() * (cells.X - 1)) * Map.CELLSIZE, ((float)Random.NextDouble() * (cells.Y - 1)) * Map.CELLSIZE); Angle orientation = Angle.FromDegree(Random.Next(0, 359)); ClassicBugItem bug = new ClassicBugItem(Context, pos, orientation); bugs.Add(bug); Engine.InsertItem(bug); } }
/// <summary> /// Default Constructor for the Type Mapper (Classic Bug). /// </summary> /// <param name="item">Related Engine Item</param> public BugState(ClassicBugItem item) : base(item) { }