Пример #1
0
 // Update is called once per frame
 void Update()
 {
     if (target != null)
     {
         //päivitä tilakone
         if (!stateUpdates.ContainsKey(bossState))
         {
             Debug.LogError("DragonBossEnemy - No update method defined for state" + bossState.ToString());
         }
         stateUpdate updateFunc = stateUpdates[bossState];
         BossState   newState   = updateFunc();
         if (newState != bossState)
         {
             Debug.Log("BossState: " + newState.ToString());
             if (stateExits.ContainsKey(bossState))
             {
                 stateExits[bossState]();
             }
             if (stateEntries.ContainsKey(newState))
             {
                 stateEntries[newState]();
             }
             bossState = newState;
         }
     }
 }
Пример #2
0
    public void setState(PlayerStates newState)
    {
        switch (newState)
        {
        case PlayerStates.CanMove:
            StateUpdate  = checkForOB;
            StateUpdate += doMovement;
            StateUpdate += colorControls;
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }

        currentState = newState;
    }
Пример #3
0
    public void setGameState(GAME_STATE newState)
    {
        Debug.Log(newState);
        currentState = newState;
        switch (newState)
        {
        case GAME_STATE.NONE:
            Debug.Log("set to none");
            StateUpdate = NoneUpdate;
            break;

        case GAME_STATE.WAIT_FOR_INPUT:
            Debug.Log("wait for input");
            Streamer.Active = true;
            StateUpdate     = WaitForInputUpdate;
            break;

        case GAME_STATE.SPEAKING:
            Debug.Log("speaking");
            if (Streamer._speechToText != null)
            {
                Streamer.Active = false;
            }
            StateUpdate = SpeakingUpdate;
            break;

        case GAME_STATE.VICTORY:
            StateUpdate = VictoryUpdate;
            break;

        case GAME_STATE.NOT_IN_CALL:
            inCallScreen.SetActive(false);
            ringingScreen.SetActive(false);
            lastCallEndedTime = Time.time;
            StateUpdate       = NotInCallUpdate;
            break;

        case GAME_STATE.RINGING:
            aSource.clip = Resources.Load <AudioClip>("Audio/phone_ring");
            aSource.loop = true;
            aSource.Play();
            ringingScreen.SetActive(true);
            StateUpdate = RingingUpdate;
            break;
        }
    }
Пример #4
0
    void setState(ScoreState newState)
    {
        switch (newState)
        {
        case ScoreState.Normal:
            StateUpdate = normalUpdate;
            break;

        case ScoreState.Party:
            partyCountdown = secondsForCurrentParty;
            StateUpdate    = partyUpdate;
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }
        currentState = newState;
    }
Пример #5
0
    public void setState(ObstacleState newState)
    {
        switch (newState)
        {
        case ObstacleState.Stopped:
            StateUpdate = stoppedUpdate;
            break;

        case ObstacleState.Moving:
            StateUpdate = doMovement;
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }

        currentState = newState;
    }
Пример #6
0
    public void setState(GameState newState)
    {
        sfxAudio.Stop();
        mainAudio.Stop();
        StopCoroutine("playTitleAnimation");
        StopCoroutine("setUpKoreoStats");

        switch (newState)
        {
        case GameState.Title:

            turnStuffOnOff(titleObjects, true);
            turnStuffOnOff(menuObjects, false);
            turnStuffOnOff(playingObjects, false);
            turnStuffOnOff(resultsObjects, false);
            StartCoroutine("playTitleAnimation");
            StateUpdate = titleUpdate;
            break;

        case GameState.Menu:

            turnStuffOnOff(titleObjects, false);

            turnStuffOnOff(menuObjects, true);
            turnStuffOnOff(playingObjects, false);
            turnStuffOnOff(resultsObjects, false);
            if (firstLoadOfCarousel)
            {
                firstLoadOfCarousel = false;
            }
            else
            {
                myCarousel.playPreviewMusic();
            }
            StateUpdate = menuUpdate;
            break;

        case GameState.Playing:
            sm.reset();
            turnStuffOnOff(titleObjects, false);

            turnStuffOnOff(playingObjects, true);
            currentSong = myCarousel.getCurrentSelection();

            myKoreor.GetComponent <SimpleMusicPlayer>().LoadSong(currentSong.koreography, 0, false);
            turnStuffOnOff(menuObjects, false);
            turnStuffOnOff(resultsObjects, false);
            StartCoroutine("setUpKoreoStats");
            if (moviePlane != null)
            {
                moviePlane.GetComponent <Renderer>().enabled = false;
            }
            myKoreor.gameObject.GetComponent <AudioSource>().Play();
            GetComponent <AudioSource>().clip = myKoreor.gameObject.GetComponent <AudioSource>().clip;
            StateUpdate = playingUpdate;

            break;

        case GameState.Result:

            om.clearAllObstacles();
            setUpResultsText();
            turnStuffOnOff(titleObjects, false);
            turnStuffOnOff(menuObjects, false);
            turnStuffOnOff(playingObjects, false);
            turnStuffOnOff(resultsObjects, true);
            mainAudio.clip = Resources.Load("Audio/results") as AudioClip;
            mainAudio.Play();
            StateUpdate = resultUpdate;
            break;

        default:
            throw new System.ArgumentOutOfRangeException();
        }
        currentState = newState;
    }