Skip to content

Programming Overview

Alex Reeser edited this page Jul 6, 2017 · 3 revisions

This page attempts to document at a high level the various systems that Red Homestead encompasses. Scripts and actions are broadly split into either Player-initiated or Tick-initiated.

Player Initiated Action Scripts

"Player Initiated" means any state change that the Player causes through input.

PlayerInput.cs

The PlayerInput class is a Monobehavior on the Player prefab that is responsible for:

  1. Player Input state (Planning or not)
  2. Raycasting for given input state
  3. Handling non-movement keystrokes like Escape and Toggle Flashlight
  4. Computing placement and placing runtime planning prefabs

Please note that #4 is not considered to be within PlayerInput's scope and should be moved to a separate class.

Tick Initiated Scripts

"Tick-initiated" here means the various long running loops, such as the FlowManager (industrial processes), SurvivalTimer (player need bars), and SunOrbit (environmental sun effects).

SurvivalTimer.cs

A Monobehavior on the Player prefab that is responsible for:

  1. Storing available survival resource information (air, water, etc)
  2. Periodically consuming these resources
  3. Providing an interface for other scripts to refill these resources

SunOrbit.cs

A Monobehavior on the Sun Directional Light transform that is responsible for:

  1. Moving the sun through the sky
  2. Setting ambient light appropriately
  3. Lighting the skybox appropriately
  4. Rotating the stars (not done yet!)
  5. Updating the Martian clock
  6. Providing an interface for scripts to subscribe to dawn and dusk events (not done yet!)
  7. Automatically turning the player's headlamps on or off

FlowManager.cs

A Monobehavior on the original Habitat transform that is responsible for:

  1. Storing datastructures for industrial nodes
  2. Pushing and pulling industrial compounds through converters and storage

User Interface Scripts

GuiBridge.cs

A Monobehavior on the Canvas transform that is responsible for:

  1. Storing references to Canvas objects
  2. Syncing Canvas UI elements to other script's state

Data Structure Classes

CuesAndPrompts.cs

This class contains the structures and data for all the prompts when the player hovers over an interactable gameplay element. All of the data is static.

ConstructionZone.cs Module and Resource classes

This is where the enums for Modules and Resources and the mappings for Module Resource requirements are.