Ejemplo n.º 1
0
    public override void enterState(GameController gc, GameState previousState = null)
    {
        Debug.Log("Entered Gameplay state.");

        //Setup references to main gameplay objects
        gpsm = GameObject.Find("GameplaySceneManager").GetComponent <GameplaySceneManager>();
    }
Ejemplo n.º 2
0
    public override void enterState(GameplaySceneManager gpsm, InGameState previousState = null)
    {
        Debug.Log("Entered (in-game) Play state.");

        //Should make sure pause menu is hidden on init
        gpsm.pauseCanvas.SetActive(false);
    }
Ejemplo n.º 3
0
    void Start()
    {
        sceneM = GameplaySceneManager.instance;

        //Initialize
        UI_carrotScore.text = "0";
    }
Ejemplo n.º 4
0
 //Returning null should indicate that the state change was not allowed/accepted
 public virtual InGameState changeState(InGameState newState, GameplaySceneManager gpsm)
 {
     this.exitState(gpsm);
     gpsm.currentState = newState;
     newState.enterState(gpsm, this);
     return(newState);
 }
Ejemplo n.º 5
0
 public override void doUpdate(GameplaySceneManager gpsm)
 {
     if (gpsm.pauseButtonPressed)
     {
         gpsm.pauseButtonPressed = false;
         changeState(gpsm.inGameState_Pause, gpsm);
     }
 }
Ejemplo n.º 6
0
    public override void exitState(GameplaySceneManager gpsm, InGameState nextState = null)
    {
        //Unfreeze time to resume gameplay
        Time.timeScale = 1;

        //Hide the pause menu
        gpsm.pauseCanvas.SetActive(false);
    }
Ejemplo n.º 7
0
    void Start()
    {
        transition   = GetComponent <PauseMenuCanvasTransition>();
        sceneManager = GameplaySceneManager.instance;
        sfxManager   = SfxManager.instance;

        UnPause();
    }
Ejemplo n.º 8
0
 public override void enterState(GameController gc, GameState previousState = null)
 {
     Debug.Log("Entered Gameplay state.");
     gpsm             = GameObject.Find("GameplaySceneManager").GetComponent <GameplaySceneManager>();
     mainCamera       = GameObject.Find("Main Camera").GetComponent <Camera>();
     player           = GameObject.Find("Player").GetComponent <PlayerController>();
     playerFireZoneUI = GameObject.Find("PlayerFireZone");
     waveSize         = 1;
 }
Ejemplo n.º 9
0
    public override void enterState(GameplaySceneManager gpsm, InGameState previousState = null)
    {
        Debug.Log("Entered (in-game) Pause state.");

        //Freeze time
        Time.timeScale = 0;

        //Activate pause menu canvas
        gpsm.pauseCanvas.SetActive(true);

        //For extra safety, should init any flags this state depends on
        gpsm.quitButtonPressed    = false;
        gpsm.unPauseButtonPressed = false;
    }
Ejemplo n.º 10
0
    public override void doUpdate(GameplaySceneManager gpsm)
    {
        if (gpsm.pauseButtonPressed)
        {
            gpsm.pauseButtonPressed = false;
            changeState(gpsm.inGameState_Pause, gpsm);
        }
        gpsm.playerSpeedTelemetry.text    = Mathf.Round(gpsm.player.speed).ToString();
        gpsm.playerDistanceTelemetry.text = Mathf.Round(gpsm.player.transform.position.z).ToString();

        if (Input.GetKeyDown("space"))
        {
            gpsm.player.Thrust();
        }

        if (Input.GetKeyDown("'"))
        {
            gpsm.player.Damage(1000, 1f);
        }
    }
Ejemplo n.º 11
0
 public virtual void exitState(GameplaySceneManager gpsm, InGameState nextState = null)
 {
 }
Ejemplo n.º 12
0
 public virtual void doFixedUpdate(GameplaySceneManager gpsm)
 {
 }
Ejemplo n.º 13
0
 //Also acts as init method
 public virtual void enterState(GameplaySceneManager gpsm, InGameState previousState = null)
 {
 }
Ejemplo n.º 14
0
 void Awake()
 {
     //Super lazy singleton
     instance = this;
 }
 void Awake()
 {
     instance     = this;
     coinsInScene = GameObject.FindObjectsOfType <Coin>().Length;
 }