Esempio n. 1
0
        void Update()
        {
            // this better be true!
            if (cameraFound)
            {
                camera.Follow(); // camera looks laggy if we just call Follow in PlayerCamera.Update()/LateUpdate()/FixedUpdate()
            }

            if (!LevelManager.gamePaused && !NPCInteract.interacting && lm.currentGameState != GameState.DEAD)
            {
                Vector2 mouseInput = inputManager.GetMouseAxes();
                switch (currState)
                {
                case PlayerFlightState.Flying:
                    FlyingControl(mouseInput);
                    break;

                case PlayerFlightState.Landed:
                    LandedControl(mouseInput);
                    break;
                }
            }

            if (inputManager.GetLandFlyKeyClicked())
            {
                switch (currState)
                {
                case PlayerFlightState.Flying:
                    currState = PlayerFlightState.Landed;
                    buzzSfx.Stop();
                    break;

                case PlayerFlightState.Landed:
                    currState = PlayerFlightState.Flying;
                    buzzSfx.Play();
                    break;
                }

                // TODO: implement fighting movement control
            }

            if (inputManager.GetVortexKeyClicked())
            {
                powerup.Activate(PlayerPowerup.Vortex);
            }

            if (inputManager.GetDanceKeyClicked())
            {
                powerup.Activate(PlayerPowerup.WaggleDance);
            }
        }
Esempio n. 2
0
        void Start()
        {
            controller   = GetComponent <CharacterController>();
            powerup      = GetComponent <PlayerPowerupBehavior>();
            inputManager = FindObjectOfType <InputManager>();
            lm           = FindObjectOfType <LevelManager>();
            buzzSfx      = GetComponent <AudioSource>();
            buzzSfx.Play();

            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;

            currState = PlayerFlightState.Flying;
        }