/// <summary> /// Creates new moving entity /// </summary> public MovingEntity() { SteeringBehaviour = new SteeringBehaviours(this); if (World.CurrentWorld != null) { World = World.CurrentWorld; } MovingEntities.Add(this); }
public override void Reveal(MarioEntity mario) { if (Items != null && Items.Count > 0)//reveal item { Entity item = Items[0]; Items.RemoveAt(0); Tile tile = new Tile { Entity = item }; CollideList.Add(tile); MovingEntities.Add(tile.Entity); //foreach (Cell cell in Cells) //{ // cell.AddEntity(item); //} //item.Cells = Cells; item.Reveal(mario); } }
public override void Update(GameTime gametime, Vector2 Velocity, GraphicsDeviceManager graphics) { Sprite.Update(gametime, Velocity, graphics); timer -= gametime.ElapsedGameTime.TotalSeconds; if (timer < 0) { Entity enemy; Random r = new Random(); int num = r.Next(0, 3); switch (num % 3) { case 0: enemy = new GoombaEntity(new Vector2(Sprite.Position.X - 32, Sprite.Position.Y)); break; case 1: enemy = new GreenKoopaEntity(new Vector2(Sprite.Position.X - 32, Sprite.Position.Y)); break; case 2: enemy = new RedKoopaEntity(new Vector2(Sprite.Position.X - 32, Sprite.Position.Y)) { SpriteVelocity = new Vector2(-1, 0) }; break; default: enemy = new GoombaEntity(new Vector2(Sprite.Position.X - 32, Sprite.Position.Y)); break; } enemy.SpriteVelocity = new Vector2(-1, 0); MovingEntities.Add(enemy); Tile tile = new Tile(); tile.Entity = enemy; tile.Position = enemy.SpritePosition; CollideList.Add(tile); timer = TIMER; } }
public override void Reveal(MarioEntity mario) //continuous reveal is possible { if (Items != null && !Items[0].Dead) //reveal piranha { Entity item = Items[0]; if (!MovingEntities.Contains(item)) { Tile tile = new Tile { Entity = item }; //foreach (Cell cell in Cells) //{ // cell.AddEntity(item); //} //item.Cells = Cells; CollideList.Add(tile); MovingEntities.Add(tile.Entity); } item.Reveal(mario); } }