Exemplo 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();
                }
            }
        }
Exemplo 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;
            }
        }
Exemplo 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;
            }
        }
Exemplo 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;
            }
        }
Exemplo 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();
            }
        }
Exemplo n.º 6
0
        public override void Execute(ActionInvokerData data)
        {
            if (!AllowInvokeWhenDisabled && !isActiveAndEnabled)
            {
                return;
            }

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

            Special.Invoke(data);

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

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

            StartCoroutine(WaitAndExecute(data));

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

            StartCoroutine(WaitAndExecute(data));

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

            SpawnObjectEx();

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

            sound.Play();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 14
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            SpawnObjectEx();

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

            ToggleDoor();
            SaveState();

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

            MonoBehaviour targetScript = FindScript();

            targetScript.Invoke(MethodName, 0);

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 18
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

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

            if (!Repeatable)
            {
                Locked = true;
            }
        }
Exemplo 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;
            }
        }
Exemplo 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;
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 22
0
 public abstract void Execute(ActionInvokerData data);
Exemplo n.º 23
0
 public override void Execute(ActionInvokerData data)
 {
     ChangeScene();
 }