예제 #1
0
        public override float Run()
        {
            if (runtimeLinkedObject != null)
            {
                if (messageToSend == MessageToSend.Custom)
                {
                    if (affectChildren)
                    {
                        if (!sendValue)
                        {
                            runtimeLinkedObject.BroadcastMessage(customMessage, SendMessageOptions.DontRequireReceiver);
                        }
                        else
                        {
                            runtimeLinkedObject.BroadcastMessage(customMessage, customValue, SendMessageOptions.DontRequireReceiver);
                        }
                    }
                    else
                    {
                        if (!sendValue)
                        {
                            runtimeLinkedObject.SendMessage(customMessage);
                        }
                        else
                        {
                            runtimeLinkedObject.SendMessage(customMessage, customValue);
                        }
                    }
                }
                else
                {
                    if (affectChildren)
                    {
                        runtimeLinkedObject.BroadcastMessage(messageToSend.ToString(), SendMessageOptions.DontRequireReceiver);
                    }
                    else
                    {
                        runtimeLinkedObject.SendMessage(messageToSend.ToString());
                    }
                }
            }
            else
            {
                LogWarning("Cannot send message - no receiving object set!");
            }

            return(0f);
        }
예제 #2
0
        override public float Run()
        {
            if (linkedObject)
            {
                if (messageToSend == MessageToSend.Custom)
                {
                    if (affectChildren)
                    {
                        if (!sendValue)
                        {
                            linkedObject.BroadcastMessage(customMessage, SendMessageOptions.DontRequireReceiver);
                        }
                        else
                        {
                            linkedObject.BroadcastMessage(customMessage, customValue, SendMessageOptions.DontRequireReceiver);
                        }
                    }
                    else
                    {
                        if (!sendValue)
                        {
                            linkedObject.SendMessage(customMessage);
                        }
                        else
                        {
                            linkedObject.SendMessage(customMessage, customValue);
                        }
                    }
                }
                else
                {
                    if (affectChildren)
                    {
                        linkedObject.BroadcastMessage(messageToSend.ToString(), SendMessageOptions.DontRequireReceiver);
                    }
                    else
                    {
                        linkedObject.SendMessage(messageToSend.ToString());
                    }
                }
            }

            return(0f);
        }