/// <summary> /// Depending on the bullet's mode, either deals damage or sends /// a team change signal. /// </summary> /// <param name="target">a target we just hit</param> void MessageToTarget(BehaviourMessageBus target) { if (mode == BulletMode.Damage) { target.Damage.Invoke(damage); } else if (mode == BulletMode.Convert) { MessageBus.Global.Convert.Invoke(target.gameObject); } }
public virtual void Awake() { //resolve MessageBus before we do anything else: _messageBus = GetComponent <BehaviourMessageBus>(); if (_messageBus == null) { //we couldn't find a message bus -- we'll have to //create one _messageBus = gameObject.AddComponent <BehaviourMessageBus>(); } }