Example #1
0
 public Angel(Vector2 position)
     : base(position)
 {
     width=7;
       height=16;
     LoadContent();
     direction = Enemy.Direction.right;
 }
    private void SpawnEnemies()
    {
        timeToNextEnemySpawn -= Time.deltaTime;

        if (timeToNextEnemySpawn < 0)
        {
            Enemy.Direction dir     = (Random.value < 0.5 ? Enemy.Direction.Left : Enemy.Direction.Right);
            bool            success = enemies[0].Spawn(dir, camera.transform.position.z + playerShip.transform.position.z);

            if (success)
            {
                // only reset the timer if an enemy was spawned successfully; otherwise, let's try again
                GenerateTimeToNextEnemySpawn();
            }
        }
    }
Example #3
0
 private void changeDirection()
 {
     if(direction == Enemy.Direction.down)
     {
         direction = Enemy.Direction.right;
     }
     else if(direction == Enemy.Direction.right)
     {
         direction = Enemy.Direction.up;
     }
     else if(direction==Enemy.Direction.up)
     {
         direction = Enemy.Direction.left;
     }
     else if(direction== Enemy.Direction.left)
     {
         direction=Enemy.Direction.down;
     }
     Console.WriteLine(direction);
 }