Beispiel #1
0
    public void ReplaceIngredientViewFactory(IngredientViewFactory newValue)
    {
        var index     = GameComponentsLookup.IngredientViewFactory;
        var component = CreateComponent <IngredientViewFactoryComponent>(index);

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Beispiel #2
0
    public GameEntity SetIngredientViewFactory(IngredientViewFactory newValue)
    {
        if (hasIngredientViewFactory)
        {
            throw new Entitas.EntitasException("Could not set IngredientViewFactory!\n" + this + " already has an entity with IngredientViewFactoryComponent!",
                                               "You should check if the context already has a ingredientViewFactoryEntity before setting it or use context.ReplaceIngredientViewFactory().");
        }
        var entity = CreateEntity();

        entity.AddIngredientViewFactory(newValue);
        return(entity);
    }
Beispiel #3
0
    public void ReplaceIngredientViewFactory(IngredientViewFactory newValue)
    {
        var entity = ingredientViewFactoryEntity;

        if (entity == null)
        {
            entity = SetIngredientViewFactory(newValue);
        }
        else
        {
            entity.ReplaceIngredientViewFactory(newValue);
        }
    }