예제 #1
0
 public Transform blueBossTransform;         //current transform data of this enemy - DELETE THIS WHEN HAS REAL MODEL
 // Use this for initialization
 void Start()
 {
     playerScript = GameObject.FindWithTag("Player").GetComponent <MoveAround>();            //cache transform data for easy access/performance
     health       = GameObject.FindGameObjectWithTag("blueEnemyHealth").GetComponent <BlueBossHealth>();
     enemiesAlive = GameObject.FindGameObjectWithTag("Manager").GetComponent <roundsAndEnemyManager>();
     BLM          = GameObject.FindGameObjectWithTag("mainFloor").GetComponent <BonusLevelManager>();
     health.background.guiTexture.enabled = true;
     GO = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameOver>();
     blueBossTransform = GameObject.FindGameObjectWithTag("BlueBoss").transform;
 }
예제 #2
0
    public Transform greenBossTransform;        //current transform data of this enemy - DELETE THIS WHEN HAS REAL MODEL

    // Use this for initialization
    void Start()
    {
        playerScript            = GameObject.FindWithTag("Player").GetComponent <MoveAround>(); //cache transform data for easy access/performance
        health                  = GameObject.FindGameObjectWithTag("greenEnemyHealth").GetComponent <GreenBossHealth>();
        enemiesAlive            = GameObject.FindGameObjectWithTag("Manager").GetComponent <roundsAndEnemyManager>();
        enemiesAlive.aliveCount = 1;
        BLM = GameObject.FindGameObjectWithTag("mainFloor").GetComponent <BonusLevelManager>();
        health.background.guiTexture.enabled = true;
        GO = GameObject.FindGameObjectWithTag("Manager").GetComponent <GameOver>();
        //shuttleControl = gameObject.GetComponent<greenBossControl>();
        greenBossTransform = GameObject.FindGameObjectWithTag("GreenBoss").transform;
    }
    void Update()
    {
        scoreText.text = score.ToString();

        if (centerTextVisibleCounter > 0.0f && centreRounds.enabled == true || centerTextVisibleCounter > 0.0f && bonusRoundText.enabled == true || centerTextVisibleCounter > 0.0f && powerupText.enabled == true)
        {
            centerTextVisibleCounter -= Time.deltaTime;
        }

        if (centerTextVisibleCounter < 0.0f)
        {
            bonusRoundText.enabled        = false;
            gameOverText.enabled          = false;
            centreRounds.enabled          = false;
            centreTotalRoundsText.enabled = false;
            powerupText.enabled           = false;
            centerTextVisibleCounter      = 1.0f;
        }
        if (finalLevel == false)
        {
            //check all spawns are in active
            for (int i = 0; i < 8; i++)
            {
                if (redSpawnPoints[0] != null)
                {
                    if (redSpawnPoints[i].GetComponent <redEnemySpawn>().isComplete == true)
                    {
                        roundComplete = true;
                        break;
                    }
                    else
                    {
                        roundComplete = false;
                        break;
                    }
                }
                if (i < 6)
                {
                    if (greenSpawnPoints[0] != null)
                    {
                        if (greenSpawnPoints[i].GetComponent <greenEnemySpawn>().isComplete == true)
                        {
                            roundComplete = true;
                            break;
                        }
                        else
                        {
                            roundComplete = false;
                            break;
                        }
                    }
                }
                if (i < 4)
                {
                    if (blueSpawnPoints[0] != null)
                    {
                        if (blueSpawnPoints[i].GetComponent <blueEnemySpawn>().isComplete == true)
                        {
                            roundComplete = true;
                            break;
                        }
                        else
                        {
                            roundComplete = false;
                            break;
                        }
                    }
                }
            }

            #region
            if (aliveCount == 0)
            {
                if (roundComplete == true)
                {
                    //print (redBossDEAD + "readBossDEAD");
                    roundComplete = false;
                    print("ROUND COMPLETE!!!!!!!!!!!");

                    // Play round complete sound audio clip at volume 0.7
                    audio.PlayOneShot(roundCompletionSound, 0.7f);

                    if (roundsCount < 5)
                    {
                        roundsCount += 1;
                        print("rounds count = " + roundsCount);
                        reset();
                        totalRounds                  += 1;
                        totalRoundsText.text          = totalRounds.ToString();
                        centreRounds.enabled          = true;
                        centreTotalRoundsText.enabled = true;
                        centreTotalRoundsText.text    = totalRounds.ToString();
                        print("total rounds = " + totalRounds);
                    }
                    else if (roundsCount == 5)
                    {
                        if (redBossDEAD == false)
                        {
                            //if not make the spawn active
                            redBossSpawn.GetComponent <redBossSpawn>().isActive = true;
                            //redBossDEAD = true;
                            for (int i = 0; i < 8; i++)
                            {
                                redSpawnPoints[i].GetComponent <redEnemySpawn>().isComplete = true;
                            }
                            roundsCount = 0;
                        }
                        if (redBossDEAD == true && greenBossDEAD == false)
                        {
                            //if not make the spawn active
                            greenBossSpawn.GetComponent <greenBossSpawn>().isActive = true;
                            //redBossDEAD = true;
                            for (int i = 0; i < 8; i++)
                            {
                                redSpawnPoints[i].GetComponent <redEnemySpawn>().isComplete = true;
                                if (i < 6)
                                {
                                    greenSpawnPoints[i].GetComponent <greenEnemySpawn>().isComplete = true;
                                }
                            }
                            roundsCount = 0;
                        }
                        if (redBossDEAD == true && greenBossDEAD == true && blueBossDEAD == false)
                        {
                            //if not make the spawn active
                            blueBossSpawn.GetComponent <blueBossSpawn>().isActive = true;
                            for (int i = 0; i < 8; i++)
                            {
                                redSpawnPoints[i].GetComponent <redEnemySpawn>().isComplete = true;
                                if (i < 6)
                                {
                                    greenSpawnPoints[i].GetComponent <greenEnemySpawn>().isComplete = true;
                                }
                                if (i < 4)
                                {
                                    blueSpawnPoints[i].GetComponent <blueEnemySpawn>().isComplete = true;
                                }
                                roundsCount = 0;
                            }
                            //roundsCount = 0;
                            print(aliveCount);
                        }
                    }
                    else
                    {
                        roundsCount = 1;
                        //print ("rounds count = " + roundsCount);
                        reset();
                    }
                }
            }
            #endregion
        }


        if (finalLevel == true)
        {
            // Load the level named "BonusLevel".
            Application.LoadLevel("BonusLevel");
            BLM                    = GameObject.FindGameObjectWithTag("mainFloor").GetComponent <BonusLevelManager>();
            redBossDEAD            = false;
            greenBossDEAD          = false;
            blueBossDEAD           = false;
            bonusRoundText.enabled = true;
        }
    }