Ejemplo n.º 1
0
    public void AddTag(PlaceableTag tag)
    {
        if (tags.Contains(tag))
        {
            return;     //Return immediately if this Placeable already has this tag. This avoids duplicating tags, as well as infinite loops.
        }
        tags.Add(tag);  //Adds the tag to the actual list

        foreach (PlaceableTag impliedTag in tag.implies)
        {
            AddTag(impliedTag); //Recursively adds all the implied tags
        }

        foreach (PlaceableTag excludedTag in tag.excludes)
        {
            if (tags.Contains(excludedTag)) //Throws a warning if there are any excluded tags. This can be useful in some cases, but usually is a problem.
            {
                Debug.LogWarning("Warning: Placeable '" + name + "' has the tag '" + excludedTag.name + "' which is excluded by '" + tag.name + "'.");
            }
        }
    }
Ejemplo n.º 2
0
    static PlaceableTag()
    {
        tagToken           = new PlaceableTag("token");
        tagSkillToken      = new PlaceableTag("token_skill");
        tagRedSkillToken   = new PlaceableTag("token_skill_red");
        tagGreenSkillToken = new PlaceableTag("token_skill_green");
        tagBlueSkillToken  = new PlaceableTag("token_skill_blue");

        tagToken.SetImplies(new PlaceableTag[] { });
        tagToken.SetExcludes(new PlaceableTag[] { });

        tagSkillToken.SetImplies(new PlaceableTag[] { tagToken });
        tagSkillToken.SetExcludes(new PlaceableTag[] { });

        tagRedSkillToken.SetImplies(new PlaceableTag[] { tagSkillToken });
        tagRedSkillToken.SetExcludes(new PlaceableTag[] { tagGreenSkillToken, tagBlueSkillToken });

        tagGreenSkillToken.SetImplies(new PlaceableTag[] { tagSkillToken });
        tagGreenSkillToken.SetExcludes(new PlaceableTag[] { tagRedSkillToken, tagBlueSkillToken });

        tagBlueSkillToken.SetImplies(new PlaceableTag[] { tagSkillToken });
        tagBlueSkillToken.SetExcludes(new PlaceableTag[] { tagRedSkillToken, tagGreenSkillToken });
    }
 public TagConditionMustInclude(PlaceableTag tag)
 {
     this.tag = tag;
 }