void OnTriggerEnter(Collider other) { print("Trigger Enter Triggered. Other is: " + other.ToString()); if (other.gameObject != null) { //If the object we're colliding with is a unitSelection bubble... - Moore UnitSelection usScript = other.transform.parent.GetComponent <UnitSelection>(); if (usScript != null) { //Then we add ourselves to the selection and start following the player. But only if we're not a player. if (shipType != ShipType.Alpha && shipType != ShipType.Node) { CommandHandler.OnCommand += HandleCommandEvent; UnitSelection.OnDeselect += HandleDeselectEvent; isSelected = true; state = State.FollowPlayer; UpdateStatusIndicator(); } } //If the object we're colliding with is a Resonator AoE bubble... - Moore ResonatorEffectAreaBehavior reab = other.GetComponent <ResonatorEffectAreaBehavior>(); if (reab != null) { print("Trigger Entered. 'Other' is: " + reab.ToString()); reab.OnResonanceChange += SetRateModifer; print(rateModifier); } } }
void OnTriggerExit(Collider other) { if (other.gameObject != null) { //If the object we're colliding with is a Resonator AoE bubble... - Moore ResonatorEffectAreaBehavior reab = other.GetComponent <ResonatorEffectAreaBehavior>(); if (reab != null) { //Then we add ourselves to the selection and start following the player. But only if we're not a player. if (shipType != ShipType.Alpha) { reab.OnResonanceChange -= SetRateModifer; RateModifier = 1f; //Reset the rate modifer immediately after we stop listening. - Moore } } } }
// Use this for initialization void Start() { gun = GetComponent <GenericUnitBehavior>(); reab = GetComponentInChildren <ResonatorEffectAreaBehavior>(); //Unlike the reab in the Generic Unit Behavior, this refers to our own reab, not one from a collision. - Moore }
// Use this for initialization void Start() { gun = GetComponent<GenericUnitBehavior>(); reab = GetComponentInChildren<ResonatorEffectAreaBehavior>(); //Unlike the reab in the Generic Unit Behavior, this refers to our own reab, not one from a collision. - Moore }