Пример #1
0
        public override Trigger Activate(IPlayable source, TriggerActivation activation = TriggerActivation.PLAY, bool cloning = false, bool asAncillary = false)
        {
            if (source.ActivatedTrigger != null && !IsAncillaryTrigger)
            {
                throw new Exceptions.EntityException($"{source} already has an activated trigger.");
            }

            var triggers = new Trigger[_triggers.Count];

            bool flag = false;

            for (int i = 0; i < triggers.Length; i++)
            {
                triggers[i] = _triggers[i]?.Activate(source, activation, cloning, true);
                if (triggers[i] != null)
                {
                    flag = true;
                }
            }

            if (!flag)
            {
                return(null);
            }

            var instance = new MultiTrigger(triggers, this, source);

            if (!IsAncillaryTrigger)
            {
                source.ActivatedTrigger = instance;
            }

            return(instance);
        }
Пример #2
0
 private MultiTrigger(Trigger[] triggers, MultiTrigger protoType, IPlayable owner) : base(protoType, owner)
 {
     _triggers = triggers;
 }