Inherits from NSObject
Declared in OGWTask.h

Overview

A task is a concrete piece of work to be performed as part of a job. Tasks act on the entity and its aspects. Tasks can also act on the world.

Tasks can either finish instantly, in which case the next task of a job runs immediately. A job with 10 instantly finishing tasks will run all 10 tasks in the same frame. Usually these tasks are setting a property of the entity or an aspect or send a message.

Some tasks may be running for a specific duration. These are called “timed tasks”.

Finally there are tasks that will only finish when a set of conditions is met or perhaps they will run indefinitely, only stopping when their job is cancelled. Such task could be, for example, a task to follow a specific entity.

Properties

entity

The entity on which this task runs.

@property (weak) OGWEntity *entity

Return Value

The entity on which this task runs.

Declared In

OGWTask.h

job

Reference to OGWJob owning this task. Gives access to OGWJobAspect.

@property (weak) OGWJob *job

Return Value

Reference to OGWJob owning this task. Gives access to OGWJobAspect.

Declared In

OGWTask.h

state

The task state.

@property (readonly) OGWTaskState state

Return Value

The task state.

Declared In

OGWTask.h

Instance Methods

abort

- (void)abort

end

- (void)end

finish

- (void)finish

proceedWithStep:

- (void)proceedWithStep:(GWStep)currentStep

startWithStep:

- (void)startWithStep:(GWStep)step

taskDidAbort

Informs the task that it should end immediately, no matter what it’s state is. This usually leaves the task’s and entity’s state as is, even if undesirable.

- (void)taskDidAbort

Declared In

OGWTask.h

taskDidEnd

Informs the task that it should end gracefully at next nearest possibility, as determined by the task. What graceful implies is defined by the task.

- (void)taskDidEnd

Declared In

OGWTask.h

taskDidFinish

Informs the task that it has finished its job. This can be used to perform cleanup.

- (void)taskDidFinish

Declared In

OGWTask.h

taskDidStartWithStep:

Informs the tasks that it was started. Allows the task to run one-time setup code.

- (void)taskDidStartWithStep:(GWStep)step

Parameters

step

The current step. Equivalent to world.simulation.currentStep.

Declared In

OGWTask.h