Esempio n. 1
0
 private void DebugButton(PS4.ButtonName buttonName)
 {
     if (PS4.GetButton(buttonName))
     {
         Debug.Log(buttonName.ToString());
     }
 }
Esempio n. 2
0
        private void DebugAxis(PS4.AxisName axisName)
        {
            var axis = PS4.GetAxis(axisName);

            if (axis > 0.1f || axis < -0.1f)
            {
                Debug.Log(axisName.ToString() + " : " + axis);
            }
        }
Esempio n. 3
0
        protected override void Update()
        {
            base.Update();

            thirdPersonCamera.SetEulerX(PS4.GetAxis(PS4.AxisName.AnalogRight_Y) * thirdPersonCamera.rotationSpeed * Time.deltaTime);
            thirdPersonCamera.SetEulerY(PS4.GetAxis(PS4.AxisName.AnalogRight_X) * thirdPersonCamera.rotationSpeed * Time.deltaTime);

            DoMovementControl();
            MovePathTrail(analogLeft, isAnalogLeftMoved);

            equipHolster.DoEquipHolster(PS4.ButtonName.Square);
        }
Esempio n. 4
0
        private void DoMovementControl()
        {
            if (!isAbleToMove)
            {
                return;
            }

            var analogLeftX = PS4.GetAxis(PS4.AxisName.AnalogLeft_X);
            var analogLeftY = PS4.GetAxis(PS4.AxisName.AnalogLeft_Y);

            if (analogLeftX == 0 && analogLeftY == 0)
            {
                animParam.isLeftAnalogMoving = false;
                return;
            }

            animParam.isLeftAnalogMoving = true;

            var camdir = camDir;

            camdir.y = 0;

            analogLeft.rotation = Quaternion.LookRotation(camdir);
            analogLeft.position = playerPos + (analogLeft.forward * analogLeftY) + (analogLeft.right * analogLeftX);

            animParam.AnalogLeftX = analogLeft.localPosition.x;
            animParam.AnalogLeftY = analogLeft.localPosition.z;

            if (!animParam.isMoving && distanceFromFurthestTail > 3)
            {
                switch (animationState)
                {
                case AnimationState.RunAnimsetBasic:
                    Move_RunAnimsetBasic(GetMovingDirection_RunAnimsetBasic());
                    break;

                case AnimationState.SwordAnimsetPro:
                    Move_SwordAnimsetPro(GetMovingDirection_SwordAnimsetPro());
                    break;

                case AnimationState.LongswordAnimsetPro:
                    Move_LongswordAnimsetPro(GetMovingDirection_RunAnimsetBasic());
                    break;
                }

                animParam.isMoving = true;
            }

            RotateTowardTrail(analogLeft);
        }
Esempio n. 5
0
        private void Update()
        {
            if (!isMoving)
            {
                if (isPlayerFacingMe)
                {
                    onInteract?.Invoke();
                }

                if (PS4.GetButtonDown(PS4.ButtonName.Circle))
                {
                    isMoving  = true;
                    isOpening = !isOpening;

                    if (doubleDoor.isMoving != true)
                    {
                        doubleDoor.OpenDoor(isOpening);
                    }

                    onLossInteract?.Invoke();
                }

                return;
            }

            if (isOpening)
            {
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(openPosition), 180 * Time.deltaTime);
                if (transform.rotation == Quaternion.Euler(openPosition))
                {
                    StartCoroutine(SetDelay());
                    isMoving = false;
                    enabled  = false;
                }
            }
            else
            {
                transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.Euler(closePosition), 180 * Time.deltaTime);
                if (transform.rotation == Quaternion.Euler(closePosition))
                {
                    StartCoroutine(SetDelay());
                    isMoving = false;
                    enabled  = false;
                }
            }
        }
Esempio n. 6
0
        private void Update()
        {
            if (PS4.GetButtonDown(PS4.ButtonName.Triangle))
            {
                if (animParam.isAttacking || !animParam.isSword1h_Equip)
                {
                    return;
                }

                animator.Play(AnimName.SwordAnimsetPro.Sword1h_Attacks.i01_Attack_Move_slow_L_1);
                animParam.isAttacking = true;
                animParam.isMoving    = false;
                controller.StopRotating();
                target = GetTargetWithSmallestAngle();

                if (target != null)
                {
                    StartCoroutine(RotateTowardTarget());
                }
            }
        }
Esempio n. 7
0
        public void DoEquipHolster(PS4.ButtonName buttonName)
        {
            if (PS4.GetButtonDown(buttonName))
            {
                if (animParam.isAttacking || animParam.isHolsterOrEquip)
                {
                    return;
                }

                animParam.isMoving = false;
                controller.StopRotating();

                if (!animParam.isSword1h_Equip)
                {
                    Equip();
                }
                else
                {
                    Holster();
                }
            }
        }