Browse Source

Fix Lua version of crowd simulation demo due to VariantMap API changes.

Yao Wei Tjong 姚伟忠 10 years ago
parent
commit
b1e1ab47c3
1 changed files with 5 additions and 5 deletions
  1. 5 5
      bin/Data/LuaScripts/39_CrowdNavigation.lua

+ 5 - 5
bin/Data/LuaScripts/39_CrowdNavigation.lua

@@ -438,15 +438,15 @@ function HandleCrowdAgentReposition(eventType, eventData)
 end
 
 function HandleCrowdAgentFormation(eventType, eventData)
-    local index = eventData:GetUInt("Index")
-    local size = eventData:GetUInt("Size")
-    local position = eventData:GetVector3("Position")
+    local index = eventData["Index"]:GetUInt()
+    local size = eventData["Size"]:GetUInt()
+    local position = eventData["Position"]:GetVector3()
 
     -- The first agent will always move to the exact position, all other agents will select a random point nearby
     if index > 0 then
         local crowdManager = GetEventSender()
-        local agent = eventData:GetPtr("CrowdAgent", "CrowdAgent")
-        eventData:SetVector3("Position", crowdManager:GetRandomPointInCircle(position, agent.radius, agent.queryFilterType))
+        local agent = eventData["CrowdAgent"]:GetPtr("CrowdAgent")
+        eventData["Position"] = crowdManager:GetRandomPointInCircle(position, agent.radius, agent.queryFilterType)
     end
 end