First incomplete version

This commit is contained in:
FlightControl
2016-11-30 12:00:32 +01:00
parent 9ab3a2f74d
commit 9c4b147b6b
8 changed files with 222 additions and 198 deletions

View File

@@ -43,45 +43,3 @@ end
--- Adds a score for the PROCESS to be achieved.
-- @param #PROCESS self
-- @param #string ProcessStatus is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).
-- @param #string ScoreText is a text describing the score that is given according the status.
-- @param #number Score is a number providing the score of the status.
-- @return #PROCESS self
function PROCESS:AddScore( ProcessStatus, ScoreText, Score )
self:F2( { ProcessStatus, ScoreText, Score } )
self.Scores[ProcessStatus] = self.Scores[ProcessStatus] or {}
self.Scores[ProcessStatus].ScoreText = ScoreText
self.Scores[ProcessStatus].Score = Score
return self
end
--- StateMachine callback function for a PROCESS
-- @param #PROCESS self
-- @param Controllable#CONTROLLABLE ProcessUnit
-- @param #string Event
-- @param #string From
-- @param #string To
function PROCESS:onstatechange( ProcessUnit, Event, From, To, Dummy )
self:E( { ProcessUnit, Event, From, To, Dummy } )
if self:IsTrace() then
MESSAGE:New( "Process " .. self.ProcessName .. " : " .. Event .. " changed to state " .. To, 15 ):ToAll()
end
self:E( self.Scores[To] )
-- TODO: This needs to be reworked with a callback functions allocated within Task, and set within the mission script from the Task Objects...
if self.Scores[To] then
local Task = self.Task
local Scoring = Task:GetScoring()
if Scoring then
Scoring:_AddMissionTaskScore( Task.Mission, ProcessUnit, self.Scores[To].ScoreText, self.Scores[To].Score )
end
end
end