Exemplo n.º 1
0
        // public Tileable makeTileManager(TileModel[] tileModels, int tileWidth){
        //     Tile[] tiles = new Tile[tileModels.Length];
        //     for (int i =0; i<tiles.Length;i++){
        //         tiles[i] = makeTile(tileModels[i]);
        //     }
        //     var state = new TileableState(){
        //         width = tileWidth,
        //         height = tileWidth,
        //         tiles = tiles
        //     };
        //     return new Tileable(state);
        // }
        public Tileable makeTileManager()
        {
            var width = (int)Random.Range(5, 15);

            Tile[] tiles = new Tile[width * width];
            for (int i = 0; i < tiles.Length; i++)
            {
                tiles[i] = makeTile(i);
            }
            var state = new TileableState()
            {
                width  = width,
                height = width,
                tiles  = tiles.referenceAll().ToArray()
            };

            return(new Tileable(state));
        }
Exemplo n.º 2
0
 public PlanetState(FactionOwnedState factionState, TileableState tileableState, Sprite icon, long id, FactoryStamp stamp, NamedState namedState, AppearablePositionState positionState, StateActionState actionState) :
     base(icon, id, stamp, namedState, positionState, factionState, actionState)
 {
     this.tileableState = tileableState;
 }
Exemplo n.º 3
0
 public Tileable(TileableState state)
 {
     this.state = state;
 }
Exemplo n.º 4
0
        private PlanetState makeState(Transform parent, Planet planet, Vector3 position, StarNode starAt, string name, Faction faction, TileableState tileState)
        {
            var state = new PlanetState(
                positionState: new State.AppearablePositionState(
                    appearTransform: parent,
                    position: position,
                    star: starAt
                    ),
                stamp:  new FactoryStamp(),
                actionState: new SelfStateActionState(planet),
                tileableState: tileState,
                id: GameManager.idMaker.newId(planet),
                namedState: new State.NamedState()
            {
                name = name
            },
                icon: planetSprites[Random.Range(0, planetSprites.Length - 1)],
                factionState: new State.FactionOwnedState()
            {
                belongsTo = faction
            }
                );

            return(state);
        }