Ejemplo n.º 1
0
    IEnumerator Attack(SfpsHealthBase target, float interval)
    {
        while (!target.Dead())
        {
            target.TakeDamage(1);

            yield return(new WaitForSeconds(interval));
        }
    }
Ejemplo n.º 2
0
    void Fire()
    {
        // Check for impact. If absent, return.
        RaycastHit hit;

        if (!Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, Mathf.Infinity))
        {
            return;
        }

        // Check if Zombie is hit
        if (hit.collider.gameObject.tag == "Zombie")
        {
            SfpsHealthBase zombie = hit.collider.gameObject.GetComponent <SfpsHealthBase>();
            zombie.TakeDamage(1);
        }
    }