Beispiel #1
0
    public MainGameManager(GameSetup gameSetup)
    {
        MapAssetSet assetSet = gameSetup.MapDefinition.GetMapAssetSet();
        Map         map      = new Map(assetSet.MapSetup);

        IEnumerable <PlayerSetup> playerSetups = PlayerSetup.CreateFromMapDefinition(assetSet.MapSetup);
        GameTurnTransition        initialState = GetInitialState(playerSetups, map);

        _turns.Add(initialState);
        _provinceNeighbors = new ProvinceNeighborsTable(CurrentState);

        ObjectManager = new UnityObjectManager(map,
                                               assetSet,
                                               gameSetup.MapPrefab,
                                               gameSetup.FactionPrefab,
                                               gameSetup.OrderIndicatorPrefab,
                                               gameSetup.ScreenCanvas,
                                               initialState.AfterEverything,
                                               playerSetups);
        InteractionManager = new InteractionManager(this,
                                                    map,
                                                    gameSetup,
                                                    ObjectManager,
                                                    playerSetups);
        DisplayManager = new GameDisplayManager(this,
                                                gameSetup,
                                                playerSetups.Select(item => item.Faction),
                                                map,
                                                ObjectManager,
                                                InteractionManager.Factions,
                                                initialState.AfterEverything);
    }
    private ComputeBuffer CreateNeighborsBuffer(MapAssetSet assetSet)
    {
        ComputeBuffer ret = new ComputeBuffer(assetSet.NeighborsTable.Count, _neighborsBufferStride);

        ret.SetData(assetSet.NeighborsTable.ToArray());
        return(ret);
    }
Beispiel #3
0
 private void Start()
 {
     _set             = MapSetup.GetMapAssetSet();
     _hexCount        = _set.MapSetup.Tiles.Count;
     _neighborsBuffer = CreateNeighborsBuffer();
     _hexStatesBuffer = new ComputeBuffer(_hexCount, HexStatesStride);
     _hexStates       = CreateHexStates();
 }
Beispiel #4
0
    private MapUnityObject MakeMapGameObject(GameObject mapPrefab, MapAssetSet mapAssets)
    {
        GameObject     obj = GameObject.Instantiate(mapPrefab);
        MapUnityObject ret = obj.GetComponent <MapUnityObject>();

        ret.Initialize(mapAssets);
        return(ret);
    }
    public void Initialize(MapAssetSet assetSet)
    {
        int bufferSize = assetSet.MapSetup.Tiles.Max(item => item.BufferIndex + 1);

        _set              = assetSet;
        _neighborsBuffer  = CreateNeighborsBuffer(assetSet);
        _tileStatesBuffer = new ComputeBuffer(bufferSize, TileStatesStride);
        _tileBufferStates = new TileBufferState[bufferSize];
    }
Beispiel #6
0
 public UnityObjectManager(Map map,
                           MapAssetSet mapAssets,
                           GameObject mapPrefab,
                           GameObject factionPrefab,
                           GameObject orderIndicatorPrefab,
                           Canvas hudCanvas,
                           GameState initialState,
                           IEnumerable <PlayerSetup> playerSetups)
 {
     MapObject        = MakeMapGameObject(mapPrefab, mapAssets);
     _factions        = MakeFactionObjects(hudCanvas, factionPrefab, playerSetups);
     _orderIndicators = MakeOrderIndicators(orderIndicatorPrefab, playerSetups);
 }