public void CreateEnemyHUD(Transform target, int initialHp)
 {
     if (enemyHUDWaitingList.Count == 0)
     {
         GameObject go = Instantiate(enemyHUDPrefab, mainCanvas.transform) as GameObject;
         EnemyHUD   e  = go.GetComponent <EnemyHUD>();
         e.SetUp(target, initialHp);
         enemyHUDList.Add(e);
     }
     else
     {
         EnemyHUD e = enemyHUDWaitingList[0];
         enemyHUDWaitingList.Remove(e);
         e.gameObject.SetActive(true);
         e.SetUp(target, initialHp);
         enemyHUDList.Add(e);
     }
 }
Ejemplo n.º 2
0
    void Awake()
    {
        agent      = GetComponent <WaypointAgent>();
        animator   = GetComponentInChildren <Animator>();
        photonView = GetComponent <PhotonView>();

        enemyHUD = GetComponentInChildren <EnemyHUD>();

        agent.MoveSpeed = Speed;

        if (DamageType == DamageType.Shared)
        {
            healthStat = new SharedHealthStat(MaxHP);
        }
        else
        {
            healthStat = new UniqueHealthStat(MaxHP, 2);
        }
    }
Ejemplo n.º 3
0
    } // Instantiates the chosen miniontype

    public void NewRound()
    {
        if (gameControllerScript.playerType == "alien" && playerEnemyScript == null)
        {
            playerEnemyScript = GameObject.Find("Enemy(Clone)").GetComponent<PlayerEnemy>();
        }

        callNewRound = false;

        gameControllerScript.waveOutcome = GameController.WaveOutcomes.Ongoing;

        if (gameControllerScript.roundNumber < gameControllerScript.lastRound && gameControllerScript.playerType == "pilot")
        {
            playerHUDScript = GameObject.Find("PlayerHUD(Clone)").GetComponent<PlayerHUD>();
            if (!playerHUDScript.readyBool)
            {
                playerHUDScript.Ready(); 
            }

            ChoosePattern();

            ChooseUpgrades();

            ChooseMinion();

            nextRound.Enabled = false;
            spawnTimer.Enabled = true;
            canSpawn = true;

            SpawnMinion();
        }
        else if (gameControllerScript.roundNumber < gameControllerScript.lastRound && gameControllerScript.playerType == "alien")
        {
            enemyHUDScript = GameObject.Find("EnemyHUD(Clone)").GetComponent<EnemyHUD>();
            enemyHUDScript.Ready();
            if (!enemyHUDScript.choseMinion)
            {
                ChooseMinion();
            }
            if (!enemyHUDScript.chosePattern)
            {
                ChoosePattern();
            }

            enemyHUDScript.choseMinion = false;
            enemyHUDScript.chosePattern = false;

            nextRound.Enabled = false;
            spawnTimer.Enabled = true;
            canSpawn = true;

            SpawnMinion();
        }
        else if (gameControllerScript.roundNumber == gameControllerScript.lastRound && gameControllerScript.playerType == "alien")
        {
            enemyHUDScript = GameObject.Find("EnemyHUD(Clone)").GetComponent<EnemyHUD>();
            enemyHUDScript.Ready();
            chosenMinionTag = "boss";
            nextRound.Enabled = false;
            spawnTimer.Enabled = false;
            canSpawn = false;
            countMinions = 10;
            Instantiate(boss, new Vector2(7.50f, 0), Quaternion.Euler(0, 0, 0));
        }
        else if (gameControllerScript.roundNumber == gameControllerScript.lastRound && gameControllerScript.playerType == "pilot")
        {
            playerHUDScript = GameObject.Find("PlayerHUD(Clone)").GetComponent<PlayerHUD>();
            playerHUDScript.Ready();
            chosenMinionTag = "boss";
            nextRound.Enabled = false;
            spawnTimer.Enabled = false;
            canSpawn = false;
            countMinions = 10;
            Instantiate(bossAI, new Vector2(10f, 0), Quaternion.Euler(0, 0, 0));
        }
    } // Starts a new round, choosing patterns, upgrades and minions