示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Enemy"))
        {
            EnemyMover em = other.gameObject.GetComponent <EnemyMover>();

            if (em.IsMoving)
            {
                em.IsMoving = false;
                em.PlayDieSound();
                em.RemoveFromTargetGroup();

                other.gameObject.GetComponent <Rigidbody>().AddExplosionForce(1000.0f, other.ClosestPointOnBounds(transform.position), 1.5f);
                //other.gameObject.GetComponent<BoxCollider>().isTrigger = true;
                other.gameObject.layer = 10;

                em.DestorySelf();
            }
        }
    }