コード例 #1
0
ファイル: GameGameStateComponent.cs プロジェクト: dqtoy/1010C
    public void ReplaceGameState(_1010C.Scripts.Components.GameState newValue)
    {
        var index     = GameComponentsLookup.GameState;
        var component = (_1010C.Scripts.Components.GameStateComponent)CreateComponent(index, typeof(_1010C.Scripts.Components.GameStateComponent));

        component.Value = newValue;
        ReplaceComponent(index, component);
    }
コード例 #2
0
ファイル: GameGameStateComponent.cs プロジェクト: dqtoy/1010C
    public GameEntity SetGameState(_1010C.Scripts.Components.GameState newValue)
    {
        if (hasGameState)
        {
            throw new Entitas.EntitasException("Could not set GameState!\n" + this + " already has an entity with _1010C.Scripts.Components.GameStateComponent!",
                                               "You should check if the context already has a gameStateEntity before setting it or use context.ReplaceGameState().");
        }
        var entity = CreateEntity();

        entity.AddGameState(newValue);
        return(entity);
    }
コード例 #3
0
ファイル: GameGameStateComponent.cs プロジェクト: dqtoy/1010C
    public void ReplaceGameState(_1010C.Scripts.Components.GameState newValue)
    {
        var entity = gameStateEntity;

        if (entity == null)
        {
            entity = SetGameState(newValue);
        }
        else
        {
            entity.ReplaceGameState(newValue);
        }
    }