Exemplo n.º 1
0
    void Awake()
    {
        input          = new DudeActions();
        ragdollControl = GetComponent <ragdollControl>();

        input.CharacterControls.ZAxis.performed += ctx =>
        {
            currentMovement.z = ctx.ReadValue <float>();
            currentMovement.Normalize();
            movementPressed = currentMovement.x != 0 || currentMovement.z != 0;
            // Debug.Log(currentMovement);
        };

        input.CharacterControls.XAxis.performed += ctx =>
        {
            currentMovement.x = ctx.ReadValue <float>();
            currentMovement.Normalize();
            movementPressed = currentMovement.x != 0 || currentMovement.z != 0;
            // Debug.Log(currentMovement);
        };

        input.CharacterControls.Run.performed += ctx =>
        {
            runPressed = ctx.ReadValueAsButton();
            // Debug.Log(runPressed);
        };

        input.CharacterControls.Roll.performed += ctx =>
        {
            rollPressed = ctx.ReadValueAsButton();
            // Debug.Log(runPressed);
            // can we just set animation bools here?
        };

        input.CharacterControls.Punch.performed += ctx =>
        {
            punchPressed = ctx.ReadValueAsButton();
            // Debug.Log(runPressed);
        };

        // ragdoll action
        input.CharacterControls.Ragdoll.performed += ctx =>
        {
            ragdollPressed = ctx.ReadValueAsButton();
            Debug.Log("Ragdoll requested");
        };


        isAnimating = true;
    }
Exemplo n.º 2
0
    private Vector3 targetVelocity;      // calculated target velocity


    void Start()
    {
        toggler       = entity.GetComponent <ragdollControl>();
        limbRigidbody = GetComponent <Rigidbody>();
    }
Exemplo n.º 3
0
    void Awake()
    {
        // isAnimating = true;

        // rollAllowed = true;



        input            = new DudeActions();
        ragdollControl   = GetComponent <ragdollControl>();   // turn on and off ragdolling
        motionController = GetComponent <motionController>(); // access motion based info, mostly speed
        ledgeDectector   = GetComponent <LedgeDetection>();

        input.CharacterControls.ZAxis.performed += ctx =>
        {
            currentMovement.z = ctx.ReadValue <float>();
            currentMovement.Normalize();
            movementPressed = currentMovement.x != 0 || currentMovement.z != 0;

            // HandleWalkAnimation(movementPressed);
            // Debug.Log(currentMovement);
        };

        input.CharacterControls.XAxis.performed += ctx =>
        {
            currentMovement.x = ctx.ReadValue <float>();
            currentMovement.Normalize();
            movementPressed = currentMovement.x != 0 || currentMovement.z != 0;

            // HandleWalkAnimation(movementPressed);
            // Debug.Log(currentMovement);
        };

        input.CharacterControls.Run.performed += ctx =>
        {
            runPressed = ctx.ReadValueAsButton();

            // HandleWalkAnimation(movementPressed);
            // Debug.Log(runPressed);
        };

        input.CharacterControls.Roll.performed += ctx =>
        {
            rollPressed = ctx.ReadValueAsButton();
            // Debug.Log(runPressed);
            // can we just set animation bools here?
            // HandleRollAnimation(rollPressed);
        };

        input.CharacterControls.Punch.performed += ctx =>
        {
            punchPressed = ctx.ReadValueAsButton();
            // HandlePunchAnimation(punchPressed);
        };

        // jump action
        input.CharacterControls.Jump.performed += ctx =>
        {
            jumpPressed = ctx.ReadValueAsButton();
            // HandleJumpAnimation(jumpPressed);
        };

        // ragdoll action started
        input.CharacterControls.Ragdoll.started += ctx =>
        {
            ragdollPressed = ctx.ReadValueAsButton();
            // Debug.Log("button down, val : " + ragdollPressed);
            // HandleRagdollAnimation(ragdollPressed);
        };
        // ragdoll action started
        input.CharacterControls.Ragdoll.performed += ctx =>
        {
            ragdollPressed = ctx.ReadValueAsButton();
            if (!ragdollPressed)
            {
                // Debug.Log("button up, val : " + ragdollPressed);
                // HandleRagdollAnimation(ragdollPressed);
            }
        };
    }