예제 #1
0
파일: Hitbox.cs 프로젝트: Aulbn/Kallhall
    public void Damage(float damage, Vector3 force)
    {
        zombieParent.currentHealth -= damage;

        if (zombieParent.currentHealth <= 0)
        {
            zombieParent.Die();
            GetComponent <Rigidbody>().AddForce(force);
        }
    }
예제 #2
0
    void Shoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out hit))
        {
            hitPoint = hit.point;
            ZombieController z = hit.collider.GetComponent <ZombieController> ();
            Debug.Log(z);
            if (z != null)
            {
                z.Die();
            }
        }
    }