Exemplo n.º 1
0
        public static bool DependsOn <A, B, C, D, E, F, G, H>(this TraitDependencies dependencies, 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 = dependencies.DependsOn(out first, out second, out third, out fourth, out fifth, out sixth, out seventh);
            var b = dependencies.DependsOn(out eighth);

            return(a && b);
        }
Exemplo n.º 2
0
        public static bool RequiresComponent <A, B, C>(this TraitDependencies dependencies, out A first, out B second, out C third) where A : Component where B : Component where C : Component
        {
            var a = dependencies.RequiresComponent(out first, out second);
            var b = dependencies.RequiresComponent(out third);

            return(a && b);
        }
Exemplo n.º 3
0
        public static bool DependsOn <A, B, C, D, E>(this TraitDependencies dependencies, 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 = dependencies.DependsOn(out first, out second, out third, out fourth);
            var b = dependencies.DependsOn(out fifth);

            return(a && b);
        }
Exemplo n.º 4
0
        public static bool DependsOn <A, B, C>(this TraitDependencies dependencies, out A first, out B second, out C third) where A : Trait where B : Trait where C : Trait
        {
            var a = dependencies.DependsOn(out first, out second);
            var b = dependencies.DependsOn(out third);

            return(a && b);
        }
Exemplo n.º 5
0
        public static bool RequiresComponent <A, B, C, D, E, F, G, H>(this TraitDependencies dependencies, 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 = dependencies.RequiresComponent(out first, out second, out third, out fourth, out fifth, out sixth, out seventh);
            var b = dependencies.RequiresComponent(out eighth);

            return(a && b);
        }
Exemplo n.º 6
0
        public static bool RequiresComponent <A>(this TraitDependencies dependencies, out A first) where A : Component
        {
            var found = dependencies.RequiresComponent <A>();

            if (dependencies.Successful)
            {
                first = found;
            }
            else
            {
                first = null;
            }
            return(dependencies.Successful);
        }
Exemplo n.º 7
0
        public static bool DependsOn <A>(this TraitDependencies dependencies, out A first) where A : Trait
        {
            var found = dependencies.DependsOn <A>();

            if (dependencies.Successful)
            {
                first = found;
            }
            else
            {
                first = null;
            }
            return(dependencies.Successful);
        }
Exemplo n.º 8
0
        public TraitDependencies TryClaim(Entity requisitor, Trait[] traits, bool initialize = true)
        {
            if (initialize && entity != null)
            {
                return(null);
            }

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

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

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