Exemplo n.º 1
0
        public void AssertEntityHasComponent(Entity entity, ComponentType componentType)
        {
            if (HasComponent(entity, componentType))
            {
                return;
            }

            if (!Exists(entity))
            {
                throw new System.ArgumentException("The Entity does not exist");
            }

            if (HasComponent(entity, componentType.TypeIndex))
            {
                throw new System.ArgumentException(
                          $"The component typeof({componentType.GetManagedType()}) exists on the entity but the exact type {componentType} does not");
            }

            throw new System.ArgumentException($"{componentType} component has not been added to the entity.");
        }