예제 #1
0
 void Update()
 {
     if (MyInputManager.GetButtonDown(MyInputManager.Button.Start))
     {
         ChangeScene();
     }
 }
예제 #2
0
    void Update()
    {
        if (stateController.CurrentState == PlayerState.Dead)
        {
            return;
        }

        leftStick  = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick);
        movement.x = leftStick.x;
        //movement.z = leftStick.y;
        movement.y = 0.0f;

        //todo:z軸に勝手に移動?
        movement.z = 1.0f;

        movement *= moveSpeed * Time.deltaTime;

        //ジャンプ
        if (MyInputManager.GetButtonDown(MyInputManager.Button.A))
        {
            if (stateController.CurrentState == PlayerState.OnGround)
            {
                ActionJump();
            }
        }

        switch (stateController.CurrentState)
        {
        case PlayerState.Jump:
            movement        *= 0.4f;
            inerVec         *= 1.01f;
            m_body.velocity += inerVec * Time.deltaTime;
            if (m_transform.position.y - oldPosition.y < 0)
            {
                stateController.CurrentState = PlayerState.Fall;
            }
            break;

        case PlayerState.Fall:
            movement        *= 0.4f;
            inerVec         *= 1.01f;
            m_body.velocity += inerVec * Time.deltaTime;
            if (IsNearGround())
            {
                AkSoundEngine.PostEvent("Footsteps", gameObject);

                m_animator.SetTrigger("Landing");
                stateController.CurrentState = PlayerState.Land;
            }
            break;

        case PlayerState.Land:
            movement *= 0.8f;
            KKUtilities.Delay(landingTime, () => stateController.CurrentState = PlayerState.OnGround, this);
            break;
        }

        oldPosition = m_transform.position;
    }
예제 #3
0
    void Update()
    {
        totalTime      += Time.deltaTime;
        timeText.Second = (int)totalTime;

        //リザルトを完成させるまでは残しておく
        if (MyInputManager.GetButtonDown(MyInputManager.Button.Start))
        {
            GameOver(false);
        }
    }
예제 #4
0
 void Update()
 {
     if (!showResult)
     {
         return;
     }
     if (MyInputManager.GetButtonDown(MyInputManager.Button.Start))
     {
         if (isTransition)
         {
             return;
         }
         isTransition = true;
         LoadSceneManager.I.LoadScene(nextSceneName, true, 1.0f, 0.3f);
     }
 }
예제 #5
0
    protected override void Update()
    {
        velocity.x = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick).x;

        anim.SetFloat("MoveSpeed", Mathf.Abs(velocity.x));

        cameraObj.transform.position = (transform.position - (Vector3.forward * cameraDistance)) + (Vector3.up);

        if (MyInputManager.GetButtonDown(MyInputManager.Button.A))
        {
            if (currentState == CharacterState.Grounding || currentState == CharacterState.Landing)
            {
                ActionJump();
            }
        }
    }
예제 #6
0
    void Update()
    {
        for (int i = 0; i < buttonLength; i++)
        {
            buttonName = (MyInputManager.Button)i;
            if (MyInputManager.GetButtonDown(buttonName))
            {
                Debug.Log("push " + buttonName + " button");
            }
        }

        for (int i = 0; i < stickButtonLength; i++)
        {
            stickButtonName = (MyInputManager.StickDirection)i;
            if (MyInputManager.IsJustStickDown(stickButtonName))
            {
                Debug.Log("push " + stickButtonName);
            }
        }

        if (MyInputManager.IsJustTriggerDown(MyInputManager.Trigger.LeftTrigger))
        {
            Debug.Log("push LeftTrigger");
        }
        if (MyInputManager.IsJustTriggerDown(MyInputManager.Trigger.RightTrigger))
        {
            Debug.Log("push RightTrigger");
        }

        float leftTrigger = MyInputManager.GetTrigger(MyInputManager.Trigger.LeftTrigger);

        if (leftTrigger != 0.0f)
        {
            Debug.Log("leftTrigger = " + leftTrigger);
        }
        float rightTrigger = MyInputManager.GetTrigger(MyInputManager.Trigger.RightTrigger);

        if (rightTrigger != 0.0f)
        {
            Debug.Log("leftTrigger = " + rightTrigger);
        }

        Vector2 leftStick = MyInputManager.GetAxis(MyInputManager.Axis.LeftStick);

        if (leftStick != Vector2.zero)
        {
            Debug.Log("leftStick = " + leftStick);
        }
        Vector2 rightStick = MyInputManager.GetAxis(MyInputManager.Axis.RightStick);

        if (rightStick != Vector2.zero)
        {
            Debug.Log("rightStick = " + rightStick);
        }
        Vector2 dPad = MyInputManager.GetAxis(MyInputManager.Axis.Dpad);

        if (dPad != Vector2.zero)
        {
            Debug.Log("dPad = " + dPad);
        }
    }