示例#1
0
    public void ReplaceShipsSetup(ShipsSetup newValue)
    {
        var index     = GameComponentsLookup.ShipsSetup;
        var component = CreateComponent <ShipsSetupComponent>(index);

        component.value = newValue;
        ReplaceComponent(index, component);
    }
示例#2
0
    public GameEntity SetShipsSetup(ShipsSetup newValue)
    {
        if (hasShipsSetup)
        {
            throw new Entitas.EntitasException("Could not set ShipsSetup!\n" + this + " already has an entity with ShipsSetupComponent!",
                                               "You should check if the context already has a shipsSetupEntity before setting it or use context.ReplaceShipsSetup().");
        }
        var entity = CreateEntity();

        entity.AddShipsSetup(newValue);
        return(entity);
    }
示例#3
0
    public void ReplaceShipsSetup(ShipsSetup newValue)
    {
        var entity = shipsSetupEntity;

        if (entity == null)
        {
            entity = SetShipsSetup(newValue);
        }
        else
        {
            entity.ReplaceShipsSetup(newValue);
        }
    }