// 4. Override "GetNewTaskData" // Create a 'blank state' on the given goose. Called just before the Task begins running. public override GooseTaskData GetNewTaskData(GooseEntity goose) { MoveGoos taskData = new MoveGoos(); taskData.timeStarted = Time.time; taskData.originalAcceleration = goose.currentAcceleration; return(taskData); }
// 4. Override "RunTask" // Run a frame of this Task on the given goose. public override void RunTask(GooseEntity goose) { // This function is only called when we're the currently running task. // The goose's taskData will be of this task's type. MoveGoos data = (MoveGoos)goose.currentTaskData; if (Time.time - data.timeStarted > 0.2) { // Set our goose's state to its default. Wandering around. API.Goose.setTaskRoaming(goose); } }