コード例 #1
0
    void Awake()
    {
        core = Core.instance;
        core.SetPlayer(transform);
        playerInput = PlayerInput.instance;

        player = ReInput.players.GetPlayer(playerID);
        characterController = GetComponent <CharacterController>();
        rb = GetComponent <Rigidbody>();

        turn          = new Turn(this);
        faceTarget    = new FaceTarget(this, inputLibrary.Left_Shoulder);
        move          = new Move(this);
        strafing      = new Strafing(this, inputLibrary.Left_Trigger);
        customGravity = new CustomGravity(this);
        groundedCheck = new GroundedCheck(this);
        edgeCheck     = new EdgeCheck(this);
        jump          = new Jump(this, inputLibrary.A);
        dash          = new Dash(this, inputLibrary.Right_Shoulder);
        attackFast    = new Attack(this, inputLibrary.X, playerProfile.attack);
        attackHeavy   = new Attack(this, inputLibrary.Y, playerProfile.attackHeavy);
        attackFeint   = new Attack(this, inputLibrary.B, playerProfile.attackFeint);

        // AnimationControl should be instantiated last to enable
        // connections to former components
        //animationControl = new AnimationControl(this, move);
    }
コード例 #2
0
        public void StrafingTestsSimplePasses()
        {
            var str = new Strafing();
            var go  = new GameObject();

            go.transform.forward = Vector3.right;
            go.transform.right   = Vector3.down;

            Assert.AreEqual(1, str.Get(new Vector3(0, 0, 1), go.transform));
        }
コード例 #3
0
        public void Construct(
            Rigidbody rigidbody,
            Animator animator,
            IInputService input)
        {
            this.rigidbody = rigidbody;
            this.animator  = animator;
            strafing       = new Strafing();

            input.MovementReceived += (i) => {
                strafingValue = strafing.Get(i, transform.parent);
            };
        }