Beispiel #1
0
    public bool CanMoveOnPlayer(bool countInput = true)
    {
        //si on ne bouge pas les input, ne rien faire
        if (countInput && playerInput.Horiz == 0 && playerInput.Verti == 0)
        {
            return(false);
        }

        //ne pas bouger quand on est gripped
        if (grip.Gripped)
        {
            return(false);
        }

        if (playerManager.AreBothNotGrounded())
        {
            return(false);
        }

        if (!worldCollision.IsGroundedSafe() && worldCollision.IsGroundeExeptionSafe())
        {
            return(true);
        }

        //on est au sol, on bouge les inputs et les coolDown JUMP & MOVE sont OP !
        return(false);
    }
Beispiel #2
0
    /// <summary>
    /// renvoi vrai ou faux si on a le droit de sauter
    /// </summary>
    /// <returns></returns>
    public bool CanJump()
    {
        //on touche pas à la touche saut
        if (!playerInput.JumpInput)
        {
            return(false);
        }

        //faux si on hold pas et quand a pas laché
        if (jumpStop && (!stayHold || (stayHold && playerInput.GripInput && ScoreManager.Instance.Data.GetSimplified())))
        {
            return(false);
        }

        if (playerInput.GripInput && ScoreManager.Instance.Data.GetSimplified())
        {
            return(false);
        }

        //faux si le cooldown n'est pas fini
        if (!coolDownJump.IsReady())
        {
            return(false);
        }

        if (!worldCollision.IsGroundedSafe() && worldCollision.IsGroundeExeptionSafe() && playerManager.AreBothNotGrounded())
        {
            Debug.Log("si les 2 joueurs sont en l'air, ne pas sauter !");
            return(false);
        }

        if (!allowWallJump && !worldCollision.IsOnFloor())
        {
            return(false);
        }


        //ici on est ok pour sauter (tester si onground pour jump ou double jump ou rien)
        Collider coll;

        if (!worldCollision.PlatformManager.IsJumpable(out coll))
        {
            return(false);
        }

        return(true);
    }