示例#1
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

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

            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#2
0
        private IEnumerator WaitAndExecute(ActionInvokerData data)
        {
            yield return(new WaitForSeconds(Delay));

            Special.Invoke(data);

            if (Repeatable)
            {
                Locked = false;
            }
        }
示例#3
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            StartCoroutine(WaitAndExecute(data));

            if (!Concurrent || !Repeatable)
            {
                Locked = true;
            }
        }
示例#4
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            sound.Play();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#5
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            SpawnObjectEx();

            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#6
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

            GameState.Instance.Player.AddItem(Item, ItemCount);
            QdmsMessageBus.Instance.PushBroadcast(new InventoryAddedMessage(Item, ItemCount));

            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#7
0
        public override void Execute(ActionInvokerData data)
        {
            if (Locked)
            {
                return;
            }

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

            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#8
0
        void Update()
        {
            if (Locked)
            {
                return;
            }

            if (Input.GetButtonDown(InputCode))
            {
                ActionInvokerData d = new ActionInvokerData {
                    Activator = GameObject.Find("Player")
                };                                                                                     //TODO utility functions
                Special.Invoke(d);

                if (!Repeatable)
                {
                    Locked = true;
                }
            }
        }
示例#9
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;
            }
        }
示例#10
0
        private void HandleCollision(GameObject other)
        {
            //Debug.Log(other);

            if (Locked)
            {
                return;
            }

            //reject not-player if we're not allowing not-player
            if (OnPlayerOnly && other.GetComponent <PlayerControl>() == null)
            {
                return;
            }

            //reject non-actors if we're not allowing not-actor
            if (OnActorsOnly && (other.GetComponent <PlayerControl>() == null || other.GetComponent <EnemyScript>() == null))
            {
                return;
            }

            //execute special
            var activator = other.gameObject;
            var data      = new ActionInvokerData()
            {
                Activator = activator
            };

            Special.Invoke(data);

            //lock if not repeatable
            if (!Repeatable)
            {
                Locked = true;
            }
        }
示例#11
0
        void Start()
        {
            ActionInvokerData d = new ActionInvokerData();

            Special.Invoke(d);
        }
示例#12
0
 public override void Execute(ActionInvokerData data)
 {
     ChangeScene();
 }
示例#13
0
 public abstract void Execute(ActionInvokerData data);