Exemplo n.º 1
0
 public override void Reset()
 {
     this.gameObject   = null;
     this.delivery     = SendMessage.MessageType.SendMessage;
     this.options      = SendMessageOptions.DontRequireReceiver;
     this.functionCall = null;
 }
Exemplo n.º 2
0
        private void DoSendMessage()
        {
            GameObject ownerDefaultTarget = base.Fsm.GetOwnerDefaultTarget(this.gameObject);

            if (ownerDefaultTarget == null)
            {
                return;
            }
            object obj           = null;
            string parameterType = this.functionCall.ParameterType;

            switch (parameterType)
            {
            case "bool":
                obj = this.functionCall.BoolParameter.Value;
                break;

            case "int":
                obj = this.functionCall.IntParameter.Value;
                break;

            case "float":
                obj = this.functionCall.FloatParameter.Value;
                break;

            case "string":
                obj = this.functionCall.StringParameter.Value;
                break;

            case "Vector2":
                obj = this.functionCall.Vector2Parameter.Value;
                break;

            case "Vector3":
                obj = this.functionCall.Vector3Parameter.Value;
                break;

            case "Rect":
                obj = this.functionCall.RectParamater.Value;
                break;

            case "GameObject":
                obj = this.functionCall.GameObjectParameter.Value;
                break;

            case "Material":
                obj = this.functionCall.MaterialParameter.Value;
                break;

            case "Texture":
                obj = this.functionCall.TextureParameter.Value;
                break;

            case "Color":
                obj = this.functionCall.ColorParameter.Value;
                break;

            case "Quaternion":
                obj = this.functionCall.QuaternionParameter.Value;
                break;

            case "Object":
                obj = this.functionCall.ObjectParameter.Value;
                break;
            }
            SendMessage.MessageType messageType = this.delivery;
            if (messageType == SendMessage.MessageType.SendMessage)
            {
                ownerDefaultTarget.SendMessage(this.functionCall.FunctionName, obj, this.options);
                return;
            }
            if (messageType == SendMessage.MessageType.SendMessageUpwards)
            {
                ownerDefaultTarget.SendMessageUpwards(this.functionCall.FunctionName, obj, this.options);
                return;
            }
            if (messageType != SendMessage.MessageType.BroadcastMessage)
            {
                return;
            }
            ownerDefaultTarget.BroadcastMessage(this.functionCall.FunctionName, obj, this.options);
        }