コード例 #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Z))
        {
            GameOver();
        }

        if (Input.GetKeyDown(KeyCode.M))
        {
            var minotaur = new Minotaur();
            minotaur.Summon();
        }
        if (Input.GetKeyDown(KeyCode.W))
        {
            var mage = new Mage();
            mage.Summon();
        }
        if (Input.GetKeyDown(KeyCode.B))
        {
            var tower = new SimpleTower();
            tower.Build(new Vector3(-39, 3, 92));
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            var tower = new FrozenTower();
            tower.Build(new Vector3(-39, 3, 92));
        }
        if (Input.GetKeyDown(KeyCode.F))
        {
            var tower = new FrozenTower();
            tower.Build(new Vector3(-39, 3, 92));
        }
    }
コード例 #2
0
 public void CreateWave()
 {
     _wave.Clear();
     for (var i = 0; i < EnemiesInWave; i++)
     {
         var enemyCase = Random.Range(0, 3);
         switch (enemyCase)
         {
             case 0:
                 _wave.Add(() =>
                 {
                     var zombie = new Zombie();
                     zombie.Summon();
                     _enemies.Add(zombie.EnemyGO);
                 });
                 break;
             case 1:
                 _wave.Add(() =>
                 {
                     var minotaur = new Minotaur();
                     minotaur.Summon();
                     _enemies.Add(minotaur.EnemyGO);
                 });
                 break;
             case 2:
                 _wave.Add(() =>
                 {
                     var mage = new Mage();
                     mage.Summon();
                     _enemies.Add(mage.EnemyGO);
                 });
                 break;
         }
     }
     EnemiesInWave+=5;
 }