Beispiel #1
0
        public static bool DependsOn <A, B, C, D, E, F, G, H>(this TraitDescriptor descriptor, out A first, out B second, out C third, out D fourth, out E fifth, out F sixth, out G seventh, out H eighth) where A : Trait where B : Trait where C : Trait where D : Trait where E : Trait where F : Trait where G : Trait where H : Trait
        {
            var a = descriptor.DependsOn(out first, out second, out third, out fourth, out fifth, out sixth, out seventh);
            var b = descriptor.DependsOn(out eighth);

            return(a && b);
        }
Beispiel #2
0
        public static bool RequiresComponent <A, B, C>(this TraitDescriptor descriptor, out A first, out B second, out C third) where A : Component where B : Component where C : Component
        {
            var a = descriptor.RequiresComponent(out first, out second);
            var b = descriptor.RequiresComponent(out third);

            return(a && b);
        }
Beispiel #3
0
        public static bool DependsOn <A, B, C, D, E>(this TraitDescriptor descriptor, out A first, out B second, out C third, out D fourth, out E fifth) where A : Trait where B : Trait where C : Trait where D : Trait where E : Trait
        {
            var a = descriptor.DependsOn(out first, out second, out third, out fourth);
            var b = descriptor.DependsOn(out fifth);

            return(a && b);
        }
Beispiel #4
0
        public static bool DependsOn <A, B, C>(this TraitDescriptor descriptor, out A first, out B second, out C third) where A : Trait where B : Trait where C : Trait
        {
            var a = descriptor.DependsOn(out first, out second);
            var b = descriptor.DependsOn(out third);

            return(a && b);
        }
Beispiel #5
0
        public static bool RequiresComponent <A, B, C, D, E, F, G, H>(this TraitDescriptor descriptor, out A first, out B second, out C third, out D fourth, out E fifth, out F sixth, out G seventh, out H eighth) where A : Component where B : Component where C : Component where D : Component where E : Component where F : Component where G : Component where H : Component
        {
            var a = descriptor.RequiresComponent(out first, out second, out third, out fourth, out fifth, out sixth, out seventh);
            var b = descriptor.RequiresComponent(out eighth);

            return(a && b);
        }
Beispiel #6
0
        public static bool RequiresComponent <A>(this TraitDescriptor descriptor, out A first) where A : Component
        {
            var found = descriptor.RequiresComponent <A>();

            if (descriptor.Successful)
            {
                first = found;
            }
            else
            {
                first = null;
            }
            return(descriptor.Successful);
        }
Beispiel #7
0
        public static bool DependsOn <A>(this TraitDescriptor descriptor, out A first) where A : Trait
        {
            var found = descriptor.DependsOn <A>();

            if (descriptor.Successful)
            {
                first = found;
            }
            else
            {
                first = null;
            }
            return(descriptor.Successful);
        }
Beispiel #8
0
        public TraitDescriptor TryClaim(Entity requisitor, Trait[] traits, bool initialize = true)
        {
            if (initialize && entity != null)
            {
                return(null);
            }

            var claims = new TraitDescriptor(requisitor, this, initialize);

            foreach (var trait in traits)
            {
                claims.Include(trait);
            }
            Configure(claims);
            if (claims.Successful)
            {
                entity = requisitor;
            }
            return(claims);
        }
Beispiel #9
0
 public virtual void Configure(TraitDescriptor descriptor)
 {
 }
Beispiel #10
0
        public bool TryClaim(Entity requisitor, Trait[] traits, out TraitDescriptor descriptor, bool initialize = true)
        {
            var result = descriptor = TryClaim(requisitor, traits, initialize);

            return(result != null && result.Successful);
        }