Exemplo n.º 1
0
        public static bool IsValidTriggerTarget(UnityEngine.Object obj, TriggerActivationType act)
        {
            if (obj == null)
            {
                return(true);
            }

            switch (act)
            {
            case TriggerActivationType.TriggerAllOnTarget:
            case TriggerActivationType.TriggerSelectedTarget:
                return(GameObjectUtil.IsGameObjectSource(obj) || obj is ITriggerable);

            case TriggerActivationType.SendMessage:
                return(GameObjectUtil.IsGameObjectSource(obj));

            case TriggerActivationType.CallMethodOnSelectedTarget:
                return(true);

            case TriggerActivationType.EnableTarget:
            case TriggerActivationType.DestroyTarget:
                return(GameObjectUtil.IsGameObjectSource(obj));
            }

            return(false);
        }
Exemplo n.º 2
0
 public void ConfigureTriggerAll(ITriggerableMechanism mechanism, object arg = null)
 {
     if (mechanism == null)
     {
         throw new System.ArgumentNullException("mechanism");
     }
     if (GameObjectUtil.IsGameObjectSource(mechanism))
     {
         _triggerable = GameObjectUtil.GetGameObjectFromSource(mechanism).transform;
     }
     else
     {
         _triggerable = mechanism as UnityEngine.Object;
     }
     if (arg == null || _triggerable == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._activationType = TriggerActivationType.TriggerAllOnTarget;
     this._methodName     = null;
     _triggerAllCache     = null;
 }
 public void Clear()
 {
     this._triggerable = null;
     this._triggerableArgs = null;
     this._activationType = TriggerActivationType.TriggerAllOnTarget;
     this._methodName = null;
 }
Exemplo n.º 4
0
 public void Clear()
 {
     this._triggerable     = null;
     this._triggerableArgs = null;
     this._activationType  = TriggerActivationType.TriggerAllOnTarget;
     this._methodName      = null;
 }
Exemplo n.º 5
0
        public void ConfigureTriggerAll(UnityEngine.Object targ, object arg = null)
        {
            if (targ == null)
            {
                throw new System.ArgumentNullException("targ");
            }
            if (GameObjectUtil.IsGameObjectSource(targ))
            {
                this.ConfigureTriggerAll(GameObjectUtil.GetGameObjectFromSource(targ));
                return;
            }
            else if (!EventTriggerTarget.IsValidTriggerTarget(targ, TriggerActivationType.TriggerAllOnTarget))
            {
                throw new System.ArgumentException("Must be a game object source of some sort.", "targ");
            }

            this._triggerable = targ;
            if (arg == null)
            {
                this._triggerableArgs = null;
            }
            else
            {
                this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
            }
            this._activationType = TriggerActivationType.TriggerAllOnTarget;
            this._methodName     = null;
        }
 public void ConfigureCallMethod(GameObject targ, string methodName, params object[] args)
 {
     if (targ == null) throw new System.ArgumentNullException("targ");
     this._triggerable = targ.transform;
     if (args == null || args.Length == 0)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = (from a in args select new VariantReference(a)).ToArray();
     }
     this._methodName = methodName;
     this._activationType = TriggerActivationType.CallMethodOnSelectedTarget;
 }
Exemplo n.º 7
0
 public void ConfigureTriggerAll(GameObject targ, object arg = null)
 {
     if (targ == null)
     {
         throw new System.ArgumentNullException("targ");
     }
     this._triggerable = targ.transform;
     if (arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._activationType = TriggerActivationType.TriggerAllOnTarget;
     this._methodName     = null;
 }
Exemplo n.º 8
0
 public void ConfigureCallMethod(UnityEngine.Object targ, string methodName, params object[] args)
 {
     if (targ == null)
     {
         throw new System.ArgumentNullException("targ");
     }
     this._triggerable = targ;
     if (args == null || args.Length == 0)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = (from a in args select new VariantReference(a)).ToArray();
     }
     this._methodName     = methodName;
     this._activationType = TriggerActivationType.CallMethodOnSelectedTarget;
 }
Exemplo n.º 9
0
 public void ConfigureSendMessage(GameObject targ, string message, object arg = null)
 {
     if (targ == null)
     {
         throw new System.ArgumentNullException("targ");
     }
     this._triggerable = targ.transform;
     if (arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._methodName     = message;
     this._activationType = TriggerActivationType.SendMessage;
     _triggerAllCache     = null;
 }
Exemplo n.º 10
0
 public void ConfigureTriggerTarget(ITriggerableMechanism mechanism, object arg = null)
 {
     if (mechanism == null)
     {
         throw new System.ArgumentNullException("mechanism");
     }
     this._triggerable = mechanism.component;
     if (arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._activationType = TriggerActivationType.TriggerSelectedTarget;
     this._methodName     = null;
     _triggerAllCache     = null;
 }
 public void ConfigureSendMessage(GameObject targ, string message, object arg = null)
 {
     if (targ == null) throw new System.ArgumentNullException("targ");
     this._triggerable = targ.transform;
     if (arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._methodName = message;
     this._activationType = TriggerActivationType.SendMessage;
     _triggerAllCache = null;
 }
 public void ConfigureTriggerTarget(ITriggerableMechanism mechanism, object arg = null)
 {
     if (mechanism == null) throw new System.ArgumentNullException("mechanism");
     this._triggerable = mechanism.component;
     if (arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._activationType = TriggerActivationType.TriggerSelectedTarget;
     this._methodName = null;
     _triggerAllCache = null;
 }
 public void ConfigureTriggerAll(GameObject targ, object arg = null)
 {
     if (targ == null) throw new System.ArgumentNullException("targ");
     this._triggerable = targ.transform;
     if(arg == null)
     {
         this._triggerableArgs = null;
     }
     else
     {
         this._triggerableArgs = new VariantReference[] { new VariantReference(arg) };
     }
     this._activationType = TriggerActivationType.TriggerAllOnTarget;
     this._methodName = null;
 }