Exemple #1
0
    private IEnumerator HitPlayer(GameObject player)
    {
        hitting = true;
        if (Random.value <= hitRate)
        {
            if (Random.value <= critRate)
            {
                crit = true;
            }
            player.SendMessage("ProcessHit", this);
            soundScript.PlayAttackSound();
        }
        else
        {
            player.SendMessage("ShowMiss");
        }

        yield return(new WaitForSeconds(hitCD));

        hitting = false;
    }