コード例 #1
0
        public override void UpdateLoop(float deltaTime)
        {
            Vector3 side   = transform.right * ActionsInterface.GetAxis(move.x);
            Vector3 upDown = transform.up * ActionsInterface.GetAxis(move.y);
            Vector3 fwd    = transform.forward * ActionsInterface.GetAxis(move.z);

            transform.position += (side + upDown + fwd) * (ActionsInterface.GetAction(speedUp) ? moveSpeedUp : moveSpeed) * deltaTime;

            float turnSpeed = this.turnSpeed * deltaTime;


            Vector3 angles = transform.rotation.eulerAngles;

            angles.z           = 0;
            angles.x          += ActionsInterface.GetAxis(look.y) * turnSpeed;
            angles.y          += ActionsInterface.GetAxis(look.x) * turnSpeed;
            transform.rotation = Quaternion.Euler(angles);
        }
コード例 #2
0
        float DecideAxis(int pos, int neg)
        {
            float axis = 0;

            if (neg >= 0)
            {
                if (ActionsInterface.GetAction(pos))
                {
                    axis += 1;
                }
                if (ActionsInterface.GetAction(neg))
                {
                    axis -= 1;
                }
            }
            else
            {
                axis = ActionsInterface.GetAxis(pos);
            }
            return(axis);
        }