예제 #1
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);
        }
예제 #2
0
 private void hydrateState(Planet planet, StarNode star, PlanetState state, Transform parent, Dictionary <long, object> stateTable)
 {
     planet.state = state;
     planet.state.positionState.appearTransform = parent;
     planet.state.positionState.starAt          = star;
     planet.state.icon = planetSprites[Random.Range(0, planetSprites.Length - 1)];
     GameManager.instance.factions.registerPlanetToFaction(planet, state.factionOwnedState.belongsTo.value);
     GameManager.idMaker.insertObject(planet, state.id);
     foreach (var tileRef in state.tileableState.tiles)
     {
         tileFactory.makeTile(tileRef, stateTable);
     }
 }