Exemplo n.º 1
0
    private void OnParticleCollision(GameObject other)
    {
        AgentControl enemy = other.transform.GetComponent <AgentControl>();

        if (enemy != null)
        {
            enemy.DamageNPC(damage);
        }
    }
Exemplo n.º 2
0
    void Shoot()
    {
        RaycastHit hit;

        if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, float.MaxValue, enemy))
        {
            AgentControl enemy = hit.transform.GetComponent <AgentControl>();

            if (enemy != null)
            {
                Debug.Log("Dying", hit.transform);
                enemy.DamageNPC(damage);
            }
        }
    }