Skip to content

Commit

Permalink
Infotainment
Browse files Browse the repository at this point in the history
  • Loading branch information
Grzegorz Tańczyk committed May 26, 2024
1 parent 81edc9f commit 30f8dd1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions games/nukes/src/game-states/state-tech-world.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { LaunchHighlight } from '../controls-render/launch-highlight';
import { GameState, GameStateComponent } from './types';
import { PointerContextWrapper } from '../controls/pointer';
import { Command } from '../controls/command';
import { Infotainment } from '../controls-render/infotainment';

const WorldComponent: GameStateComponent = ({}) => {
const [worldState, setWorldState] = useState(() => createWorldState());
Expand All @@ -34,6 +35,7 @@ const WorldComponent: GameStateComponent = ({}) => {
<WorldStateRender state={worldState} />

<LaunchHighlight />
<Infotainment worldState={worldState} />
</StateContainer>
</PointerContextWrapper>
</SelectionContextWrapper>
Expand Down
26 changes: 24 additions & 2 deletions games/nukes/src/world/world-state-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,47 @@ export function createWorldState(): WorldState {
id: 'test-state',
name: 'TestState',
},
{
id: 'test-state2',
name: 'TestState2',
},
],
cities: [
{
id: 'test-city',
name: 'TestCity',
stateId: 'test-state',
position: { x: 100, y: 100 },
populationHistogram: [
{
timestamp: 0,
population: 1000000,
},
],
},
{
id: 'test-city2',
name: 'TestCity2',
stateId: 'test-state',
position: { x: 150, y: 100 },
populationHistogram: [
{
timestamp: 0,
population: 1000000,
},
],
},
{
id: 'test-city3',
name: 'TestCity3',
stateId: 'test-state',
stateId: 'test-state2',
position: { x: 150, y: 50 },
populationHistogram: [
{
timestamp: 0,
population: 1000000,
},
],
},
],
launchSites: [
Expand All @@ -40,7 +62,7 @@ export function createWorldState(): WorldState {
{
type: EntityType.LAUNCH_SITE,
id: 'test-launch-site-2',
stateId: 'test-state',
stateId: 'test-state2',
position: { x: 200, y: 200 },
},
],
Expand Down
4 changes: 4 additions & 0 deletions games/nukes/src/world/world-state-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export type City = {
stateId: StateId;
name: string;
position: Position;
populationHistogram: Array<{
timestamp: number;
population: number;
}>;
};

export enum EntityType {
Expand Down

0 comments on commit 30f8dd1

Please sign in to comment.