mega cool table of tasks for ai!!
This commit is contained in:
parent
af05a9fde3
commit
d6644fb799
@ -21,19 +21,9 @@ local function closestCharacter(char)
|
||||
return charTarget
|
||||
end
|
||||
|
||||
--- @class AIBehavior : Behavior
|
||||
--- @field animationNode AnimationNode?
|
||||
--- @field target Vec3?
|
||||
local behavior = {}
|
||||
behavior.__index = behavior
|
||||
behavior.id = "ai"
|
||||
|
||||
function behavior.new()
|
||||
return setmetatable({}, behavior)
|
||||
end
|
||||
|
||||
--- @return Task<nil>
|
||||
function behavior:makeTurn()
|
||||
---@type {[Class]: fun(self): Task<nil>} возможно где-то здесь на объявлении типа сломается типизация
|
||||
local aiNature = {
|
||||
["dev_warrior"] = function(self)
|
||||
return function(callback) -- почему так, описано в Task
|
||||
self.owner:try(Tree.behaviors.spellcaster, function(spellB)
|
||||
local charTarget = closestCharacter(self.owner)
|
||||
@ -54,6 +44,35 @@ function behavior:makeTurn()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end,
|
||||
["dev_mage"] = function(self)
|
||||
return function(callback)
|
||||
print("etoh... bleh")
|
||||
callback()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
--- @class AIBehavior : Behavior
|
||||
--- @field animationNode AnimationNode?
|
||||
--- @field target Vec3?
|
||||
local behavior = {}
|
||||
behavior.__index = behavior
|
||||
behavior.id = "ai"
|
||||
|
||||
--- @param class Class
|
||||
function behavior.new(class)
|
||||
return setmetatable({
|
||||
makeTurn = aiNature[class]
|
||||
}, behavior)
|
||||
end
|
||||
|
||||
--- @return Task<nil>
|
||||
function behavior:makeTurn()
|
||||
return function(callback)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
return behavior
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user