예제 #1
0
    public void Start()
    {
        hero             = GameObject.FindGameObjectWithTag("Player");
        rend             = GetComponent <Renderer>();
        meshcol          = GetComponent <MeshCollider>();
        main             = GameObject.FindGameObjectWithTag("MainFormation").GetComponent <MainEnemyFormation>();
        spawnDisableTime = 10.0f;
        // get end direction random
        GalagaHelper.SetEnemy2Random();
        GalagaHelper.Enemy2PathEnd = GalagaHelper.Enemy2PathDirection();
        // get Tranform.Lookat() for Enemy2
        GalagaHelper.Enemy2LookAt();
        //Debug.Log("Enemy2Random: ".Colored(Colors.red) + GalagaHelper.Enemy2Random);
        round1Phase1spawner = GameObject.Find("Round1Phase1EnemyFormation").GetComponent <EnemySpawner>();
        scoreKeeper         = GameObject.Find("Score").GetComponent <ScoreKeeper>();
        isEnemyFiring       = false;
        //Debug.Log("enemies spawned: " + GalagaHelper.EnemiesSpawned);

        // Wave 1 path creation.
        if (GalagaHelper.JustSpawned <= 8)
        {
            // Spawn 1 of 5 phases
            if (round1Phase1spawner.spawnEntranceRight)
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownRight));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
            else
            {
                myTween.Add("path", GalagaHelper.EntrancePatterns(GalagaHelper.EntranceFlightPatterns.round1_DownLeft));
                myTween.Add("delay", GalagaHelper.Wave1Delay);
                GalagaHelper.Wave1Delay += fDelay;
                //Debug.Log("1 WAVE DELAY; " + GalagaHelper.Wave1Delay);
            }
        }

        // Collect all 1st wave enemies and move them all at once with a delay
        if (GalagaHelper.JustSpawned < 9)
        {
            myTween.Add("time", movePathTime);
            myTween.Add("easetype", "linear");
            myTween.Add("onComplete", "EnemyCompletePath");
            myTween.Add("onCompleteTarget", gameObject);
            GalagaHelper.CollectEnemyPaths(gameObject, myTween);
            //GalagaHelper.CurrentRoundPhase += 1;
        }

        if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase2 && GalagaHelper.JustSpawned <= 16)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase2, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase3 && GalagaHelper.JustSpawned <= 24)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase3, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase4 && GalagaHelper.JustSpawned <= 32)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase4, GalagaHelper.RoundNumber);
        }
        else if (GalagaHelper.CurrentRoundPhase == GalagaHelper.Formations.Round1Phase5 && GalagaHelper.JustSpawned <= 40)
        {
            CreatePathAndMove(GalagaHelper.Formations.Round1Phase5, GalagaHelper.RoundNumber);
            spawnDisableTime = 2.0f;
        }
    }