Documentation ¶
Overview ¶
Package instance implements a standalone structure that is capable of running a game.
Index ¶
- func StartScript(is IInstance, charsToActOn ...component.GOiD) error
- type IInstance
- type Instance
- func (is *Instance) AddQuest(id component.GOiD, questName string)
- func (is *Instance) CreateFromMap(mapName string) ([]component.GOiD, error)
- func (is *Instance) CreateObject(objName string, loc math.Vec3) (component.GOiD, error)
- func (is *Instance) GetEventManager() *event.EventManager
- func (is *Instance) GetSceneManagerSnapshot() component.SceneManager
- func (is *Instance) MoveGameObject(id component.GOiD, newLoc math.Vec3)
- func (is *Instance) RenderFromPerspective(id component.GOiD)
- func (is *Instance) RunAi(id component.GOiD)
- func (is *Instance) Tick(secs float64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IInstance ¶
type IInstance interface { CreateFromMap(mapName string) ([]component.GOiD, error) CreateObject(objName string, loc math.Vec3) (component.GOiD, error) MoveGameObject(id component.GOiD, newLoc math.Vec3) AddQuest(id component.GOiD, questName string) RunAi(id component.GOiD) RenderFromPerspective(id component.GOiD) GetSceneManagerSnapshot() component.SceneManager GetEventManager() *event.EventManager Tick(dtime float64) }
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
The instance struct is used as an individual structure that is used to encapsulate the game state. Each instance has its own separate state from all other instances. It is the core piece of the game, and it represents one self-suficient portion of a game. Multiple instances could be bound together in a game to represent various levels or zones.
func MakeInstance ¶
func MakeInstance(rm *res.ResourceManager, parentEventDelegate event.EventListener) *Instance
MakeInstance returns a pointer to an Instance. parentEventDelegate is a function that certain events will get passed along to. This will be used to help string together multiple instances to work together. A series of managers for various systems are created inside the function and a fully initialized Instance is returned.
func (*Instance) CreateFromMap ¶
CreateFromMap is a helper function to create a map from a filename string.
func (*Instance) CreateObject ¶
CreateObject is a helper function to create a GameObject with a starting location.
func (*Instance) GetEventManager ¶
func (is *Instance) GetEventManager() *event.EventManager
GetEventManager returns a pointer to the instance's event manager.
func (*Instance) GetSceneManagerSnapshot ¶
func (is *Instance) GetSceneManagerSnapshot() component.SceneManager
GetSceneManagerSnapshot is used by the graphics manager to request a snapshot of the location data during the current frame. The graphics manager uses this to depict the scene for the current frame without data corruption.
func (*Instance) MoveGameObject ¶
MoveGameObject moves the GameObject in the transform manager.
func (*Instance) RenderFromPerspective ¶
func (*Instance) Tick ¶
Loop is launched as a goroutine and updates on its own. This function does some initialization, but then jumps into an infinite loop. When the loop breaks, a bool will be sent along the returnlink that the instance was created with. The returnlink is expected to be periodically checked for activity because this indicates an exit of the main loop of the instance.