예제 #1
0
파일: Angel.cs 프로젝트: sergigandia/Zelda
 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();
            }
        }
    }
예제 #3
0
파일: Angel.cs 프로젝트: sergigandia/Zelda
 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);
 }