Ejemplo n.º 1
0
    public override void HandleInput(PlayerController playerController)
    {
        List <Trick> tricks = playerController.GetTricks();

        //foreach (Trick trick in tricks) Debug.Log(trick.Name);

        if (tricks.Count != 0)
        {
            Trick latestTrick = tricks[tricks.Count - 1];
            if (latestTrick.IsAirTrick && !playerStats.DoingTrick)
            {
                tricks.RemoveAt(tricks.Count - 1);
                latestTrick.DoExecute(stateManager.gameObject);
                ScoreManager.Instance.AddTrickToSequence(latestTrick);
            }
        }
    }
    public override void HandleInput(PlayerController playerController)
    {
        //Debug.Log(playerController.GetRawTrickControl().y);
        animator.SetFloat("CrouchValue", playerController.GetRawTrickControl().y * -1f);

        if (playerController.GetRawTrickControl().y > 0.5f)
        {
            stateManager.SwitchState(PlayerCrouchState.ID);
        }

        List <Trick> tricks = playerController.GetTricks();

        if (tricks.Count != 0)
        {
            Trick latestTrick = tricks[tricks.Count - 1];
            tricks.RemoveAt(tricks.Count - 1);

            if (!latestTrick.IsAirTrick)
            {
                if (!playerStats.DoingTrick)
                {
                    latestTrick.DoExecute(stateManager.gameObject);
                    ScoreManager.Instance.AddTrickToSequence(latestTrick);
                }

                // remove automatically added air tricks
                foreach (Trick trick in tricks)
                {
                    if (trick.IsAirTrick)
                    {
                        tricks.Remove(trick);
                    }
                }
            }
        }

        playerStats.Velocity = new Vector3(playerController.GetMovement().x, playerStats.Velocity.y, 1);
        //Debug.Log("Number of tricks in queue: " + playerController.GetTricks().Count);
        // check left - right movement
        // check ground trick input
    }