public void ReplaceRestartable(Sources.Utils.RestartFase newFase)
    {
        var index     = GameComponentsLookup.Restartable;
        var component = CreateComponent <Sources.Components.RestartableComponent>(index);

        component.fase = newFase;
        ReplaceComponent(index, component);
    }
Esempio n. 2
0
    public void AddRestartGame(Sources.Utils.RestartFase newFase)
    {
        var index     = InputComponentsLookup.RestartGame;
        var component = CreateComponent <Sources.Components.RestartGameComponent>(index);

        component.fase = newFase;
        AddComponent(index, component);
    }
    public GameEntity SetRestartable(Sources.Utils.RestartFase newFase)
    {
        if (hasRestartable)
        {
            throw new Entitas.EntitasException("Could not set Restartable!\n" + this + " already has an entity with Sources.Components.RestartableComponent!",
                                               "You should check if the context already has a restartableEntity before setting it or use context.ReplaceRestartable().");
        }
        var entity = CreateEntity();

        entity.AddRestartable(newFase);
        return(entity);
    }
    public void ReplaceRestartable(Sources.Utils.RestartFase newFase)
    {
        var entity = restartableEntity;

        if (entity == null)
        {
            entity = SetRestartable(newFase);
        }
        else
        {
            entity.ReplaceRestartable(newFase);
        }
    }