//IEnumerator OnTriggerEnter(Collider other) // other.transform.position == target.position //{ // if (other.CompareTag("Player")) // { // if (gameObject.CompareTag("Enemy") && (target.position.y > transform.position.y + .1f)) // { // linkToPlayerControls.velocity.y = deathForce; // Managers.Audio.Play(soundCrash, transform, 6.0f, 1.0f); // enemyState = ShooterState.Stunned; // Destroy(Instantiate(ParticleStars, transform.position, transform.rotation), 5); // } // else if (Input.GetAxis("Vertical") != 0) // { // Destroy(Instantiate(ParticleStars, thisTransform.position, thisTransform.rotation), 5); // Managers.Audio.Play(soundCrash, thisTransform); // linkToPlayerControls.velocity.y = deathForce; // } // } // else if (other.CompareTag("p_shot")) // { // Managers.Register.Score += 10 * Random.Range(1, 15); // BeatDown(); // } // else if (gameObject.CompareTag("p_shot") && !other.CompareTag("Item")) // { // yield return new WaitForSeconds(0.01f); // BeatDown(); // } //} void OnDestroy() { if (ActiveBehaviour != null) { ActiveBehaviour.OnDeinit(); ActiveBehaviour = null; //this is it } }
public void SetBehaviour(Behaviours.BehaviourBase behaviour) { if (ActiveBehaviour != null) { ActiveBehaviour.OnDeinit(); ActiveBehaviour = null; } ActiveBehaviour = behaviour; if (ActiveBehaviour != null) { ActiveBehaviour.OnInit(gameObject); //ActiveBehaviour->SetTarget(posX, posY, posZ); } else { Debug.Log("The Behaviour was null, nothing created"); } }