void OnTriggerEnter(Collider other) { if (other.tag == "Enemy") { enemyid itsID = other.GetComponent <EnemyID>().theID; if (itsID == enemyid.shadowCloud) { other.GetComponent <AIShadowCloud>().target = gameObject; } } }
void OnTriggerStay(Collider other) { if (other.tag == "Enemy") { enemyid itsID = other.GetComponent <EnemyID>().theID; if (itsID != enemyid.shadowCloud) { Vector2 moveTo = (transform.position - other.transform.position).normalized; CharacterController theController = other.GetComponent <CharacterController>(); theController.Move(moveTo * Time.deltaTime * 2); } } }