private void SpawnEnemy() { EnemyLifeForm enemy = new EnemyLifeForm(attackBehaviourStage: EvolutionStage.Improved, defenseBehaviourStage: EvolutionStage.Default, movementBehaviourStage: EvolutionStage.Default) { Position = _player.Position + new Vector2(200 /* CurrEnemyLifeForms.Count*/, 100 * CurrEnemyLifeForms.Count), Texture = "characters/enemy/temp_enemy", BoundingBox = new Point(61, 61), Velocity = new Vector2(2, 2) }; CurrEnemyLifeForms.Add(enemy); }
public void TestNoCollision() { PlayerLifeForm player = new PlayerLifeForm() { BoundingBox = new Point(100, 100), Position = new Vector2(350, 350) }; EnemyLifeForm enemy = new EnemyLifeForm(EvolutionStage.Default, EvolutionStage.Default, EvolutionStage.Default) { BoundingBox = new Point(100, 100), Position = new Vector2(500, 500) }; Assert.IsFalse(CollisionHandler.ImageTouches(player, enemy)); }
public void CheckOverlapsImages() { PlayerLifeForm player = new PlayerLifeForm() { BoundingBox = new Point(100, 100), Position = new Vector2(350, 350) }; EnemyLifeForm enemy = new EnemyLifeForm(EvolutionStage.Default, EvolutionStage.Default, EvolutionStage.Default) { BoundingBox = new Point(100, 100), Position = new Vector2(350, 350) }; Vector2 otherIndex = CollisionHandler.PositionToPixelImage(new Vector2(100, 100), player.Position, enemy.Position); int xMin = (int)otherIndex.X; int yMin = (int)otherIndex.Y; Assert.IsTrue((xMin >= 0) && (xMin < 100) && (yMin >= 0) && (yMin < 100)); }