Beispiel #1
0
 void OnCollisionEnter(Collision coll)
 {
     if (coll.gameObject.tag == "Floor" && inState == true)
     {
         stateMachine.SetState(StateID2.Idle);
         audioSource.PlayOneShot(jumpSound);
     }
 }
Beispiel #2
0
 void OnCollisionEnter(Collision coll)
 {
     if (coll.gameObject.tag == GameTags.floor && inState == true)
     {
         stateMachine.SetState(StateID2.SoftLanding);
     }
 }
Beispiel #3
0
    public override void Reason()
    {
        if (anim.GetCurrentAnimatorStateInfo(0).IsName("Soft Landing"))
        {
            if (!Input.anyKeyDown)
            {
                stateMachine.SetState(StateID2.Idle);
            }
            StartCoroutine(SoftLandingLag());
        }

        if (rb.velocity != Vector3.zero)
        {
            rb.velocity = Vector3.zero;
        }
    }
Beispiel #4
0
 public override void Reason()
 {
     anim.SetInteger("AnimState", 2);
     if (inputHandler.AskForLightAttack())
     {
         stateMachine.SetState(StateID2.LightSpecial);
     }
     else if (inputHandler.AskForHeavyAttack())
     {
         stateMachine.SetState(StateID2.HeavySpecial);
     }
     else if ((Input.GetAxis("Horizontal2") == 0))
     {
         stateMachine.SetState(StateID2.Idle);
     }
     else if ((Input.GetAxis("Horizontal2") < 0))
     {
         stateMachine.SetState(StateID2.WalkBackward);
     }
     else if (Input.GetButtonDown("A2"))
     {
         stateMachine.SetState(StateID2.StandLightAttack);
     }
     else if (Input.GetButtonDown("B2"))
     {
         stateMachine.SetState(StateID2.StandHeavyAttack);
     }
     else if (Input.GetButtonDown("X2"))
     {
         stateMachine.SetState(StateID2.JumpForward);
     }
 }
 void ReadInputs()
 {
     if (inputHandler.AskForLightAttack())
     {
         stateMachine.SetState(StateID2.LightSpecial);
     }
     else if (inputHandler.AskForHeavyAttack())
     {
         stateMachine.SetState(StateID2.LightSpecial);
     }
     else if (Input.GetAxis("Vertical2") == 0)
     {
         Input.ResetInputAxes();
         stateMachine.SetState(StateID2.Idle);
     }
     else if (Input.GetButtonDown("A2"))
     {
         stateMachine.SetState(StateID2.CrouchLightAttack);
     }
     else if (Input.GetButtonDown("B2"))
     {
         //Input.ResetInputAxes();
         stateMachine.SetState(StateID2.CrouchHeavyAttack);
     }
     else if (Input.GetAxis("Horizontal2") > 0.2f)
     {
         stateMachine.SetState(StateID2.WalkForward);
     }
     else if (Input.GetAxis("Horizontal2") < -0.2f)
     {
         stateMachine.SetState(StateID2.WalkBackward);
     }
 }
    IEnumerator LightAtkLockTime()
    {
        yield return(new WaitForSeconds(lockTime));

        if (inState)
        {
            if (Input.GetAxis("Vertical") >= 0)
            {
                //Input.ResetInputAxes();
                stateMachine.SetState(StateID2.Idle);
            }
            else if (Input.GetAxis("Vertical") < 0)
            {
                //Debug.Log("Go back to crouch");
                stateMachine.SetState(StateID2.Crouch);
            }
        }
    }
    //time untill player can move again
    IEnumerator LightAtkLockTime()
    {
        yield return(new WaitForSeconds(lockTime));

        if (inState)
        {
            if (!Input.anyKey || Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.Space))
            {
                stateMachine.SetState(StateID2.Idle);
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {
                stateMachine.SetState(StateID2.WalkBackward);
            }
            else if (Input.GetKey(KeyCode.RightArrow))
            {
                stateMachine.SetState(StateID2.WalkForward);
            }
        }
    }
    void Start()
    {
        //change to inspector later
        stateMachine = GetComponent <StateMachine2>();

        MakeStates();

        stateMachine.SetState(StateID2.Idle);

        anim.SetInteger("AnimState", 0);
        Debug.Log("done idle");
    }
    IEnumerator LightAtkLockTime()
    {
        yield return(new WaitForSeconds(lockTime));

        if (inState)
        {
            if (!Input.anyKey)
            {
                stateMachine.SetState(StateID2.Idle);
            }
        }
    }
Beispiel #10
0
 public override void Reason()
 {
     anim.SetInteger("AnimState", 1);
     if (hadouken.GetInput())
     {
         stateMachine.SetState(StateID2.LightSpecial);
     }
     else if (Input.GetAxis("Horizontal2") == 0)
     {
         stateMachine.SetState(StateID2.Idle);
     }
     else if (Input.GetAxis("Horizontal2") > 0)
     {
         stateMachine.SetState(StateID2.WalkForward);
     }
     else if (Input.GetButtonDown("A2"))
     {
         stateMachine.SetState(StateID2.StandLightAttack);
     }
     else if (Input.GetButtonDown("B2"))
     {
         stateMachine.SetState(StateID2.StandHeavyAttack);
     }
     else if (Input.GetButtonDown("X2"))
     {
         stateMachine.SetState(StateID2.JumpBackward);
     }
 }
Beispiel #11
0
    //time untill player can move again
    IEnumerator HeavyAtkLockTime()
    {
        yield return(new WaitForSeconds(lockTime));

        if (inState)
        {
            if (!Input.anyKey || Input.GetKey(KeyCode.X) || Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.Space))
            {
                stateMachine.SetState(StateID2.Idle);
                Input.ResetInputAxes();
                //Debug.Log("<color=green> TO IDLE FROM HEAVY ATTACK </color>");
            }
            else if (Input.GetKey(KeyCode.RightArrow))
            {
                stateMachine.SetState(StateID2.WalkForward);
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {
                stateMachine.SetState(StateID2.WalkBackward);
            }
            Input.ResetInputAxes();
        }
    }
Beispiel #12
0
 void ReadInputs()
 {
     if (inputHandler.AskForLightAttack())
     {
         stateMachine.SetState(StateID2.LightSpecial);
     }
     else if (inputHandler.AskForHeavyAttack())
     {
         stateMachine.SetState(StateID2.HeavySpecial);
     }
     else if (Input.GetAxis("Horizontal2") < 0)
     {
         //walk left
         stateMachine.SetState(StateID2.WalkBackward);
     }
     else if (Input.GetAxis("Horizontal2") > 0)
     {
         //walk right
         stateMachine.SetState(StateID2.WalkForward);
     }
     else if (Input.GetButtonDown("A2"))
     {
         stateMachine.SetState(StateID2.StandLightAttack);
     }
     else if (Input.GetButtonDown("B2"))
     {
         stateMachine.SetState(StateID2.StandHeavyAttack);
     }
     else if (((Input.GetAxis("Vertical2") < -0.1)) && inState == true)
     {
         stateMachine.SetState(StateID2.Crouch);
     }
     else if (Input.GetButtonDown("X2") && grounded == true && inState == true)
     {
         Debug.Log("Jump from idle");
         stateMachine.SetState(StateID2.Jump);
     }
 }