Exemple #1
0
    /// <summary>
    /// Generic message handler to process options.
    /// </summary>
    /// <param name="msg"></param>
    private void handleMsg(string msg)
    {
        GameObject GO;

        if (this.otherTarget == null)
        {
            GO = this.gameObject;
        }
        else
        {
            GO = this.otherTarget;
        }

        if (this.debugLevel > DEBUG_LEVELS.Off)
        {
            Debug.Log(string.Format("Sending message '{0}' to '{1}'", msg, GO));
        }

        if (this.messageMode == MESSAGE_MODE.Send)
        {
            GO.SendMessage(msg, SendMessageOptions.DontRequireReceiver);
        }
        else
        {
            GO.BroadcastMessage(msg, SendMessageOptions.DontRequireReceiver);
        }
    }