public static LifeNPCType toPositive(this TargetSubClass flags) { bool ok = flags == TargetSubClass.AllTarget; if (ok) { return(LifeNPCType.SkTarAll); } //默认所有的都选择出来 LifeNPCType type = LifeNPCType.SkTarAll; //不要建筑物 ok = flags.check(TargetSubClass.Forbid_Building); if (ok) { type = type.clear(LifeNPCType.Build); } //不要小兵 ok = flags.check(TargetSubClass.Forbid_Unit); if (ok) { type = type.clear(LifeNPCType.Soldier); } //不要英雄 ok = flags.check(TargetSubClass.Forbid_Hero); if (ok) { type = type.clear(LifeNPCType.Hero); } //不要召唤物 ok = flags.check(TargetSubClass.Forbid_Summon); if (ok) { type = type.clear(LifeNPCType.Summon); } return(type); }
public static TargetSubClass set(this TargetSubClass flags, TargetSubClass totest) { return(flags | totest); }
public static bool check(this TargetSubClass flags, TargetSubClass totest) { return((flags & totest) == totest); }