Ejemplo n.º 1
0
    public GameEntity ReplaceTime(Assets.Code.Services.ITimeService newValue)
    {
        var index     = GameComponentsLookup.Time;
        var component = (Assets.Code.Components.Time)CreateComponent(index, typeof(Assets.Code.Components.Time));

        component.Value = newValue;
        ReplaceComponent(index, component);
        return(this);
    }
Ejemplo n.º 2
0
    public GameEntity SetTime(Assets.Code.Services.ITimeService newValue)
    {
        if (hasTime)
        {
            throw new Entitas.EntitasException("Could not set Time!\n" + this + " already has an entity with Assets.Code.Components.Time!",
                                               "You should check if the context already has a timeEntity before setting it or use context.ReplaceTime().");
        }
        var entity = CreateEntity();

        entity.AddTime(newValue);
        return(entity);
    }
Ejemplo n.º 3
0
    public void ReplaceTime(Assets.Code.Services.ITimeService newValue)
    {
        var entity = timeEntity;

        if (entity == null)
        {
            entity = SetTime(newValue);
        }
        else
        {
            entity.ReplaceTime(newValue);
        }
    }