예제 #1
0
    void WaveControl() //Control GameProgress from StartUp -> BuildPlate -> MinionGenerated -> StartUp/Destroy
    {
        float timeInterval     = this.GetPhaseInterval(currentPhase);
        bool  releaseInAdvance = (currentPhase == ProgressPhase.MinionGenerated && minionHolder.minionsCount == 0); //Wipeout all minions

        if (Time.time - timeLastWave > timeInterval || releaseInAdvance)
        {
            timeLastWave = Time.time;
            switch (currentPhase)
            {
            case ProgressPhase.StartUp:                       //Establish first/next plate(level)
            case ProgressPhase.Destroy:
                nextLevel = levelController.GetNextSection(); //Get next level information from levelController
                cameraControl.SetCamera(nextLevel);
                GenerateUnEstablish();
                plateCount++;
                waveRemain   = WAVE_PER_LEVEL;
                currentPhase = ProgressPhase.PlateGenerated;
                break;

            case ProgressPhase.PlateGenerated:     //Generate Next Wave
                if (nextLevel[0].type == Plate.PlateType.Boss)
                {
                    SpawnMinions(true);     // Start Spawn Boss or Minions
                    levelController.NextWave(WAVE_PER_LEVEL);
                    waveRemain = 0;
                }
                else
                {
                    SpawnMinions();     // Start SpawnMinions
                }
                currentPhase = ProgressPhase.MinionGenerated;
                break;

            case ProgressPhase.MinionGenerated: //Wave end/time out
                if (waveRemain != 0)            //next wave
                {
                    waveRemain--;
                    currentPhase = ProgressPhase.PlateGenerated;
                }
                if (plateCount >= PLATE_PER_STAGE)     //next stage
                {
                    ClearPlates();
                    currentPhase = ProgressPhase.Destroy;
                }
                else      //next level
                {
                    currentPhase = ProgressPhase.StartUp;
                }

                levelController.NextWave();
                break;
            }
            if (OnChangeProgressPhase != null)
            {
                this.OnChangeProgressPhase(currentPhase);
            }
        }
        return;
    }
예제 #2
0
    //Time Interval Table
    public float GetPhaseInterval(ProgressPhase phase)
    {
        switch (phase)
        {
        case ProgressPhase.StartUp:         return(startUpInterval);

        case ProgressPhase.PlateGenerated:  return(waveInterval);

        case ProgressPhase.MinionGenerated: return(waveMaxInterval);

        case ProgressPhase.Destroy:         return(reStartUpInterval);

        default:
            Debug.LogWarning("GetPhaseInterval : Unknown Phase");
            return(0);
        }
    }