Esempio n. 1
0
        void Update()
        {
            if (Triggered)
            {
                return;
            }

            bool inputPressed = false;

            if (UseKeyInput)
            {
                inputPressed = UnityEngine.Input.GetKeyDown(InputCode);
            }
            else
            {
                inputPressed = MappedInput.GetButtonDown(InputCode);
            }

            if (inputPressed)
            {
                ActionInvokerData d = new ActionInvokerData {
                    Activator = WorldUtils.GetPlayerController()
                };                                                                                             //TODO utility functions
                Special.Invoke(d);

                if (!Repeatable)
                {
                    Triggered = true;
                    SaveState();
                }
            }
        }
Esempio n. 2
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            if (Target == null)
            {
                Debug.LogWarning(string.Format("ToggleComponentSpecial on {0} has null target!", gameObject.name));
                return;
            }

            if (AlwaysForceDisable)
            {
                Target.enabled = false;
            }
            else if (AlwaysForceEnable)
            {
                Target.enabled = true;
            }
            else
            {
                Target.enabled = !Target.enabled;
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 3
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            if (AlwaysForceDisable)
            {
                Target.SetActive(false);
            }
            else if (AlwaysForceEnable)
            {
                Target.SetActive(true);
            }
            else
            {
                Target.SetActive(Target.activeSelf);
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 4
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            object[] args = ScriptArguments;
            if (AutoconvertArguments)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    args[i] = TypeUtils.StringToNumericAuto((string)args[i]);
                }
            }

            ScriptingModule.Call(Script, new ScriptExecutionContext {
                Caller = this, Activator = data.Activator.gameObject
            }, args);

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 5
0
        void OnTriggerEnter(Collider other)
        {
            if (Triggered)
            {
                return;
            }

            //reject not-player if we're not allowing not-player
            if (OnPlayerOnly && other.gameObject == WorldUtils.GetPlayerObject())
            {
                return;
            }

            //execute special
            var activator = other.GetComponent <BaseController>();
            var data      = new ActionInvokerData()
            {
                Activator = activator
            };

            Special.Invoke(data);

            //lock if not repeatable
            if (!Repeatable)
            {
                Triggered = true;
                SaveState();
            }
        }
Esempio n. 6
0
        public override void Execute(ActionInvokerData data)
        {
            if (!AllowInvokeWhenDisabled && !isActiveAndEnabled)
            {
                return;
            }

            ChangeScene();
        }
Esempio n. 7
0
        private IEnumerator WaitAndExecute(ActionInvokerData data)
        {
            yield return(new WaitForSeconds(Delay));

            Special.Invoke(data);

            if (Repeatable)
            {
                Locked = false;
            }
        }
Esempio n. 8
0
        void Start()
        {
            RestoreState();

            if (!Triggered)
            {
                ActionInvokerData d = new ActionInvokerData();
                Special.Invoke(d);
                Triggered = true;
                SaveState();
            }
        }
Esempio n. 9
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            StartCoroutine(WaitAndExecute(data));

            if (!Concurrent || !Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 10
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            StartCoroutine(WaitAndExecute(data));

            if (!Concurrent || !Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 11
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            SpawnObjectEx();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 12
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            sound.Play();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 13
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            QdmsMessageBus.Instance.PushBroadcast(new HUDPushMessage(UseSubstitution ? Sub.Macro(Message) : Message));

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 14
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            SpawnObjectEx();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 15
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            ToggleDoor();
            SaveState();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 16
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            MonoBehaviour targetScript = FindScript();

            targetScript.Invoke(MethodName, 0);

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 17
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            MonoBehaviour targetScript = FindScript();

            targetScript.Invoke(MethodName, 0);

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 18
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            foreach (ActionSpecialEvent sp in Specials)
            {
                sp.Invoke(data);
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 19
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            foreach (ActionSpecialEvent sp in Specials)
            {
                sp.Invoke(data);
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 20
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked || (!AllowInvokeWhenDisabled && !isActiveAndEnabled))
            {
                return;
            }

            if (Event != null)
            {
                Event.Invoke();
            }
            if (ActionEvent != null)
            {
                ActionEvent.Invoke(data);
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 21
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            if (Target == null)
            {
                Debug.LogWarning(string.Format("DestroyObjectSpecial on {0} has no target!", gameObject.name));
            }
            else
            {
                Destroy(Target);
            }

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Esempio n. 22
0
 public abstract void Execute(ActionInvokerData data);
Esempio n. 23
0
 public override void Execute(ActionInvokerData data)
 {
     ChangeScene();
 }