コード例 #1
0
    //unity methods


    // Use this for initialization
    void Awake()
    {
        myProperties = gameObject.GetComponent <DudeProperties>();
        myDecisions  = gameObject.GetComponent <DudeDecisions>();
        myActions    = gameObject.GetComponent <DudeActions>();

        animator = GetComponent <Animator>();
    }
コード例 #2
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;
    }
コード例 #3
0
    void Awake()
    {
        // isAnimating = true;

        // rollAllowed = true;
        layerMask = 1 << 9;

        // This would cast rays only against colliders in layer 8.
        // But instead we want to collide against everything except layer 8. The ~ operator does this, it inverts a bitmask.
        layerMask = ~layerMask;


        input          = new DudeActions();
        ledgeDectector = GetComponent <LedgeDetection>();

        isAirborne = false;
        isHanging  = false;
        isJumping  = false;
        isGrounded = true;

        // input.CharacterControls.Shoot.performed += ctx => ShootBoolet(ctx.ReadValueAsButton());

        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);
            }
        };
    }
コード例 #4
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);
            }
        };
    }
コード例 #5
0
 //initialize
 void Awake()
 {
     myProperties = gameObject.GetComponent <DudeProperties>();
     myActions    = gameObject.GetComponent <DudeActions>();
 }
コード例 #6
0
    // Start is called before the first frame update
    void Awake()
    {
        input = new DudeActions();

        input.CharacterControls.Shoot.performed += ctx => ShootBoolet(ctx.ReadValueAsButton());
    }
コード例 #7
0
    // // hid detection bools
    // [HideInInspector] public bool hitDetected = false;
    // [HideInInspector] public GameObject hitTarget = null;

    // ragdoll control
    // ragdollControl ragdollControl;

    void Awake()
    {
        input = new DudeActions();
        animationController = GetComponent <animationController>();
        // ragdollControl = GetComponent<ragdollControl>();

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

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

            // Debug.Log("button current movement: " + currentMovement);
            HandleWalkMotion(currentMovement);
            // 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?
            HandleRollMotion(rollPressed);
        };

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

            HandlePunchMotion(punchPressed);
        };

        input.CharacterControls.Jump.performed += ctx =>
        {
            jumpPressed = ctx.ReadValueAsButton();

            HandleJumpMotion(jumpPressed);
        };

        // ragdoll action
        input.CharacterControls.Ragdoll.started += ctx =>
        {
            ragdollPressed = ctx.ReadValueAsButton();

            HandleRagdollMotion(ragdollPressed);
        };

        // ragdoll action
        input.CharacterControls.Ragdoll.performed += ctx =>
        {
            ragdollPressed = ctx.ReadValueAsButton();

            if (!ragdollPressed)
            {
                HandleRagdollMotion(ragdollPressed);
            }
        };
    }