Wednesday, October 5, 2022
HomeGame Developmentunity - How do I do a splash injury utilizing this technique?

unity – How do I do a splash injury utilizing this technique?


  [SerializeField]float dashingSpeed = 25f;
[SerializeField]float dashingTime = 0.2f;
float dashingCoolDown = 1f;
bool candash = true;
bool IsDashing;
[SerializeField]float MovingSpeed = 10f;
Rigidbody rb;

 void dashing()
{
    if (Enter.GetKeyDown(KeyCode.W) && candash)
    {
        StartCoroutine(Dashing());
    }
}

   IEnumerator Dashing()
    {
        candash = false;
        IsDashing = true;
        rb.velocity = rework.proper * dashingSpeed;
        rework.gameObject.tag = "dashes";
        yield return new WaitForSeconds(dashingTime);
        IsDashing = false;
        rework.gameObject.tag = "Participant";
        yield return new WaitForSeconds(dashingCoolDown);
        candash = true;
    }

Hello, i used to be pondering of adjusting a gameobject tag throughout the sprint however typically it did not work, like my recreation object stays below “Participant” as an alternative of adjusting typically. Which is bizarre. why?
oh i do that as a result of like as soon as it change throughout that “dashing” length, the opposite recreation object will take injury when acquired hit by that tag. So it would really feel like that object take injury throughout the dashes

p.s, i welcome some other recommendations for sprint injury haha

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments