示例#1
0
        public override TaskResult Run(ITaskNode node)
        {
            var ctx     = node.Context;
            var targets = ctx.GetGameObjects(this.Target);

            var tagsToSet   = MultiTags.Parse(this.Set);
            var tagsToUnset = MultiTags.Parse(this.Unset);

            foreach (var t in targets)
            {
                var multitags = t.GetComponent <MultiTags>();

                if (multitags == null)
                {
                    throw new InvalidOperationException(string.Format("Target gameobject {0} does not have a MultiTags component", t));
                }

                foreach (var tag in tagsToSet)
                {
                    multitags.AddTag(tag);
                }

                foreach (var tag in tagsToUnset)
                {
                    multitags.RemoveTag(tag);
                }
            }

            return(TaskResult.Success);
        }
示例#2
0
        public override TaskResult Run(ITaskNode node)
        {
            var ctx     = node.Context;
            var require = MultiTags.Parse(this.Require);
            var include = MultiTags.Parse(this.Include);
            var exclude = MultiTags.Parse(this.Exclude);

            var filtered = MultiTags.FindGameObjectsWithTags(require, include, exclude);

            ctx.SetItem(this.Assign, filtered);

            return(TaskResult.Success);
        }