コード例 #1
0
 //The enemy was killed with damage.
 public void OnDiedEnemy(apTutorial_PirateGame_Enemy enemy)
 {
     if (enemy.enemyType == apTutorial_PirateGame_Enemy.ENEMY_TYPE.Dragon)
     {
         liveDragonList.Remove(enemy);
     }
     else if (enemy.enemyType == apTutorial_PirateGame_Enemy.ENEMY_TYPE.Slime)
     {
         liveSlimeList.Remove(enemy);
     }
 }
コード例 #2
0
        // Initialize
        //----------------------------------------------------------------------------------
        // Use this for initialization
        void Start()
        {
            bombList.Clear();
            for (int i = 0; i < 10; i++)
            {
                GameObject duplicatedBombGameObject       = Instantiate <GameObject>(bomb.gameObject);
                apTutorial_PirateGame_Bomb duplicatedBomb = duplicatedBombGameObject.GetComponent <apTutorial_PirateGame_Bomb>();
                duplicatedBomb.Hide();
                bombList.Add(duplicatedBomb);
            }

            bulletList.Clear();
            for (int i = 0; i < 20; i++)
            {
                GameObject duplicatedBulletGameObject         = Instantiate <GameObject>(bullet.gameObject);
                apTutorial_PirateGame_Bullet duplicatedBullet = duplicatedBulletGameObject.GetComponent <apTutorial_PirateGame_Bullet>();
                duplicatedBullet.Hide();
                bulletList.Add(duplicatedBullet);
            }

            dragonList.Clear();
            slimeList.Clear();
            for (int i = 0; i < 10; i++)
            {
                GameObject duplicatedDragonGameObject        = Instantiate <GameObject>(dragon.gameObject);
                apTutorial_PirateGame_Enemy duplicatedDragon = duplicatedDragonGameObject.GetComponent <apTutorial_PirateGame_Enemy>();
                duplicatedDragon.Initialize();                //<<
                dragonList.Add(duplicatedDragon);

                GameObject duplicatedSlimeGameObject        = Instantiate <GameObject>(slime.gameObject);
                apTutorial_PirateGame_Enemy duplicatedSlime = duplicatedSlimeGameObject.GetComponent <apTutorial_PirateGame_Enemy>();
                duplicatedSlime.Initialize();                //<<
                slimeList.Add(duplicatedSlime);
            }

            spawnCount = 0.0f;
            liveDragonList.Clear();
            liveSlimeList.Clear();

            _gameState    = GAME_STATE.Ready;
            _isFirstFrame = true;

            Vector3 leftPos  = Camera.main.ScreenToWorldPoint(new Vector3(0, Screen.height, 0));
            Vector3 rightPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));

            scoreUIGroup.position     = new Vector3(leftPos.x, scoreUIGroup.position.y, scoreUIGroup.position.z);
            howToPlayUIGroup.position = new Vector3(rightPos.x, howToPlayUIGroup.position.y, howToPlayUIGroup.position.z);
        }