Beispiel #1
0
 public override void Intersection(WIFlags other)
 {
     Alignment  = other.Alignment & Alignment;
     Occupation = other.Occupation & Occupation;
     Region     = other.Region & Region;
     Faction    = other.Faction & Faction;
     Wealth     = other.Wealth & Wealth;
 }
Beispiel #2
0
 public override void Union(WIFlags other)
 {
     Alignment  = other.Alignment | Alignment;
     Occupation = other.Occupation | Occupation;
     Region     = other.Region | Region;
     Faction    = other.Faction | Faction;
     Wealth     = other.Wealth | Wealth;
 }
Beispiel #3
0
 public virtual void Intersection(WIFlags other)
 {
     Wealth     &= other.Wealth;
     Alignment  &= other.Alignment;
     Occupation &= other.Occupation;
     Region     &= other.Region;
     Subject    &= other.Subject;
     Faction    &= other.Faction;
 }
Beispiel #4
0
 public virtual void Union(WIFlags other)
 {
     Wealth     |= other.Wealth;
     Alignment  |= other.Alignment;
     Occupation |= other.Occupation;
     Region     |= other.Region;
     Subject    |= other.Subject;
     Faction    |= other.Faction;
 }
Beispiel #5
0
 public virtual bool Check(WIFlags otherFlags)
 {
     return                                    // (true);//TEMP
            (Flags.Check(Occupation, otherFlags.Occupation, Flags.CheckType.MatchAny) &&
             Flags.Check(Alignment, otherFlags.Alignment, Flags.CheckType.MatchAny) &&
             Flags.Check(Faction, otherFlags.Faction, Flags.CheckType.MatchAny) &&
             Flags.Check(Region, otherFlags.Region, Flags.CheckType.MatchAny) &&
             Flags.Check(Subject, otherFlags.Subject, Flags.CheckType.MatchAny) &&
             Flags.Check(Wealth, otherFlags.Wealth, Flags.CheckType.MatchAny));
 }
Beispiel #6
0
 public virtual void CopyFrom(WIFlags other)
 {
     Size       = other.Size;
     BaseRarity = other.BaseRarity;
     Wealth     = other.Wealth;
     Alignment  = other.Alignment;
     Occupation = other.Occupation;
     Region     = other.Region;
     Subject    = other.Subject;
     Faction    = other.Faction;
 }
Beispiel #7
0
        public static WIFlags Intersection(WIFlags flags1, WIFlags flags2)
        {
            WIFlags newFlags = ObjectClone.Clone <WIFlags>(flags1);

            newFlags.Alignment  &= flags2.Alignment;
            newFlags.Faction    &= flags2.Faction;
            newFlags.Occupation &= flags2.Occupation;
            newFlags.Region     &= flags2.Region;
            newFlags.Subject    &= flags2.Subject;
            newFlags.Wealth     &= flags2.Wealth;
            return(newFlags);
        }
Beispiel #8
0
        public void SafeIntersection(WIFlags other)
        {
            int alignment  = other.Alignment & Alignment;
            int occupation = other.Occupation & Occupation;
            int region     = other.Region & Region;
            int faction    = other.Faction & Faction;
            int wealth     = other.Wealth & Wealth;

            Alignment  = (alignment > 0) ? alignment : Alignment;
            Occupation = (occupation > 0) ? occupation : Occupation;
            Region     = (region > 0) ? region : Region;
            Faction    = (faction > 0) ? faction : Faction;
            Wealth     = (wealth > 0) ? wealth : Wealth;
        }
Beispiel #9
0
        public List <GenericWorldItem> GetItems(WIFlags flags)
        {
            Initialize();

            List <GenericWorldItem> items = new List <GenericWorldItem> ();

            for (int i = 0; i < GenericWorldItems.Count; i++)
            {
                if (GenericWorldItems [i].HasFlags)
                {
                    if (GenericWorldItems [i].Flags.Check(flags) && Stacks.Can.Fit(GenericWorldItems [i].Flags.Size, flags.Size))
                    {
                        items.Add(GenericWorldItems [i]);
                    }
                }
            }
            return(items);
        }
Beispiel #10
0
        public bool GetItem(WIFlags flags, int hashCode, ref int lastIndex, out GenericWorldItem genericItem)
        {
            genericItem = null;

            if (IsEmpty)
            {
                //Debug.Log ("Category was empty");
                return(false);
            }
            //use the hashcode and index to get a random lookup table index
            int indexLookup              = 0;
            int objectIndex              = 0;
            int searchOffset             = Mathf.Abs(hashCode + lastIndex);
            GenericWorldItem currentItem = null;

            for (int i = 0; i < indexTable.Count; i++)
            {
                //go for the entire length of the array
                //get an index - this will increment the last index
                indexLookup = (searchOffset + i) % indexTable.Count;
                objectIndex = indexTable [indexLookup];
                currentItem = GenericWorldItems [objectIndex];

                if (flags.Check(currentItem.Flags))
                {
                    if (Stacks.Can.Fit(currentItem.Flags.Size, flags.Size))
                    {
                        genericItem = currentItem;
                        lastIndex   = indexLookup + 1;
                        break;
                    }
                }
            }

            return(genericItem != null);
        }
Beispiel #11
0
 public WICatItem()
 {
     Flags      = new WIFlags();
     Flags.Size = WISize.NoLimit;
 }