Exemplo n.º 1
0
    void Awake()
    {
        playerInput = new PlayerInputActions();
        player      = GetComponent <Player> ();
        gameState   = FindObjectOfType <LevelGameState>();

        playerInput.Player.Jump.started   += OnJumpPerformed;
        playerInput.Player.Switch.started += OnSwitchPerformed;
    }
Exemplo n.º 2
0
    void Start()
    {
        gameState = FindObjectOfType <LevelGameState>();

        requiredKeys.text = gameState.levelKeysCount.ToString();
        UpdateCollectedKeys();

        EventHub.Instance.AddListener <KeyCollectedEvent>(OnKeyCollected);
    }
Exemplo n.º 3
0
    void Start()
    {
        controller = GetComponent <DeadOneRaycastController>();
        collisions = GetComponent <DeadOneCollisionsController>();

        gravity         = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;

        gameState = FindObjectOfType <LevelGameState>();
    }
Exemplo n.º 4
0
        public void OnGameStart()
        {
            gameState = FindObjectOfType <LevelGameState>();
            if (gameState == null || gameState.levelData == null)
            {
                Debug.Log($"Missing game state!");
                return;
            }

            countdownTimerText.text = "--:--";
        }
Exemplo n.º 5
0
    public void OnGameStart()
    {
        levelGameState = FindObjectOfType <LevelGameState>();

        if (levelGameState == null || levelGameState.levelData == null)
        {
            Debug.LogWarning("Missing assigned LevelScriptableObject for this level!");
            enabled = false;
            return;
        }

        ambienceInstance = FMODUnity.RuntimeManager.CreateInstance(levelGameState.levelData.levelAmbience);
        ambienceInstance.start();
    }
	void Awake()
	{
		Instance = this;

		mainMenuState = new MainMenuState(this);
		levelSelectionState = new LevelSelectionState(this);
		levelGameState = new LevelGameState(this);
		levelLoseState = new LevelLoseState(this);
		levelWonState = new LevelWonState(this);
		levelExitState = new ExitGameState(this);

		if (!levelManager)
		{
			levelManager = LevelsManager.Instance;
		}
	}
Exemplo n.º 7
0
        public void Update(GameTime gameTime)
        {
            oldMouseState = mouseState;
            mouseState    = Mouse.GetState();
            mousePos      = new Point(mouseState.X, mouseState.Y);
            switch (currentGameState)
            {
            case GameState.Mainmenu:
                background.Update();
                if (nextChoice == false)
                {
                    playChoice = new Rectangle((int)530, (int)350, TextureManager.emptyTex.Width, TextureManager.emptyTex.Height);
                    quitChoice = new Rectangle((int)530, (int)450, TextureManager.emptyTex.Width, TextureManager.emptyTex.Height);
                    if (mouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
                    {
                        if (playChoice.Contains(mousePos))
                        {
                            nextChoice = true;
                        }
                    }
                }
                else if (nextChoice == true)
                {
                    returnChoice = new Rectangle((int)530, (int)550, TextureManager.empty2Tex.Width, TextureManager.empty2Tex.Height);
                    levelOne     = new Rectangle((int)530, (int)350, TextureManager.empty2Tex.Width, TextureManager.empty2Tex.Height);
                    levelTwo     = new Rectangle((int)530, (int)400, TextureManager.empty2Tex.Width, TextureManager.empty2Tex.Height);
                    levelThree   = new Rectangle((int)530, (int)450, TextureManager.empty2Tex.Width, TextureManager.empty2Tex.Height);
                    levelFour    = new Rectangle((int)530, (int)500, TextureManager.empty2Tex.Width, TextureManager.empty2Tex.Height);
                    if (mouseState.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton == ButtonState.Released)
                    {
                        if (returnChoice.Contains(mousePos))
                        {
                            nextChoice = false;
                        }
                        if (levelOne.Contains(mousePos))
                        {
                            currentLevel     = LevelGameState.LevelOne;
                            currentGameState = GameState.Play;
                        }
                        if (levelTwo.Contains(mousePos))
                        {
                            currentLevel     = LevelGameState.LevelTwo;
                            currentGameState = GameState.Play;
                        }
                        if (levelThree.Contains(mousePos))
                        {
                            currentLevel     = LevelGameState.LevelThree;
                            currentGameState = GameState.Play;
                        }
                        if (levelFour.Contains(mousePos))
                        {
                            currentLevel     = LevelGameState.LevelFour;
                            currentGameState = GameState.Play;
                        }
                    }
                }
                break;

            case GameState.Play:
                switch (currentLevel)
                {
                case LevelGameState.LevelOne:
                    level1.Update(gameTime);
                    break;

                case LevelGameState.LevelTwo:
                    break;

                case LevelGameState.LevelThree:
                    break;

                case LevelGameState.LevelFour:
                    break;
                }
                break;

            case GameState.Gameover:
                break;

            case GameState.Win:
                break;
            }
        }
Exemplo n.º 8
0
 void Start()
 {
     gameState = FindObjectOfType <LevelGameState>();
 }