コード例 #1
0
    private void OnParticleCollision(GameObject other)
    {
        AgentControl enemy = other.transform.GetComponent <AgentControl>();

        if (enemy != null)
        {
            enemy.DamageNPC(damage);
        }
    }
コード例 #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);
            }
        }
    }