local timer = require("level.timer")
local LD = require("design.LevelDesignLibrary")
local lspirit, weaponObject
local expireTime = 2.5
local holdTime = 0.75
local effects = {}
function OnScriptLoaded(level, go)
  for gameobj in game.Player.FindPlayer():IterateActiveWeapons() do
    if gameobj.Weapon:GetName() == "axe00" then
      weaponObject = gameobj.Weapon
    end
  end
end
function OnUpdate(level, go)
  expireTime = expireTime - level:GetUnitTime()
  holdTime = holdTime - level:GetUnitTime()
  if expireTime <= 0 then
    for _, i in ipairs(effects) do
      i:Destroy()
    end
    go:Destroy()
  elseif 0 < holdTime and #effects < 10 then
    local anotherspark = game.FX.Spawn("LightningSpirit", level)
    anotherspark:SetWorldPosition(weaponObject.WorldPosition)
    table.insert(effects, anotherspark)
  end
end
function OnWeirdHook(level, go)
  lspirit:Destroy()
  go:Destroy()
end
