Exemplo n.º 1
0
        // returns compile-time type T for EntityComponentType enum
        public static Type GetTypeForComponentType(EntityComponentType type)
        {
            switch (type)
            {
            case EntityComponentType.Damageable:
                return(typeof(DamageableComponent));

            case EntityComponentType.Selectable:
                return(typeof(SelectableComponent));

            case EntityComponentType.AI:
                return(typeof(AIComponent));

            case EntityComponentType.Capacities:
                return(typeof(CapacitiesComponent));

            // TODO: remove fall through to default
            case EntityComponentType.Movement:
            case EntityComponentType.None:
            default:
                throw new ArgumentException("EntityManager: queried EntityComponentType is unsupported.");
            }
        }
Exemplo n.º 2
0
 public static EntityComponentsMask Or(this EntityComponentsMask mask, EntityComponentType type)
 {
     return(mask | (EntityComponentsMask)(1 << (int)type));
 }
Exemplo n.º 3
0
 protected EntityComponent(EntityComponentType type)
 {
     Type = type;
 }