private void OnTriggerEnter(Collider other) { if (other.CompareTag("NPFish")) { npf = other.transform.parent.GetComponent <NPFish>(); npf.jumpReady = true; } }
void SpawnFish() { NPFish prefab = fishPrefabs[Random.Range(0, fishPrefabs.Length)]; NPFish spawn = prefab.GetPooledInstance <NPFish>(); //NPFish spawn = Instantiate<NPFish>(prefab); //spawn.transform.localPosition = transform.position; }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("NPFish")) { // Set the next waypoint npf = other.transform.parent.GetComponent <NPFish>(); npf.target = npf.RandomizePosition(nextTarget); // set the colliding fish's new target } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("NPFish")) { npf = other.transform.parent.GetComponent <NPFish>(); // assumes collider on the child, and script on the parent npf.ReturnToPool(); // return to the Object Pool, since npf is a pooled object npf.ResetNPF(); } }