Метатабличный / Говнокод #16820 Ссылка на оригинал

0

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
function SAEController:GetPointVariableValue(WayNet,CurPoint)
  local waypointVars = {};
  for i = 0, WayNet:GetPointsCount() - 1 do
     local Link = WayNet:GetPoint(i);
    local PlaySound1 = Link:GetVariableValue("PlaySound1");
    local PlaySound2 = Link:GetVariableValue("PlaySound2");
    local PlaySound3 = Link:GetVariableValue("PlaySound3");
    
    local Effect1 = Link:GetVariableValue("Effect1");
    local Effect2 = Link:GetVariableValue("Effect2");
    local Effect3 = Link:GetVariableValue("Effect3");
    
    if PlaySound1 and CurPoint == Link then
      waypointVars.PlaySound1 = PlaySound1;  
    end;
    if PlaySound2 and CurPoint == Link then
      waypointVars.PlaySound2 = PlaySound2;  
    end;
    if PlaySound3 and CurPoint == Link then
      waypointVars.PlaySound3 = PlaySound3;  
    end;
    
    if Effect1 and CurPoint == Link then
      waypointVars.Effect1 = Effect1;  
    end;
    if Effect2 and CurPoint == Link then
      waypointVars.Effect2 = Effect2;  
    end;
    if Effect3 and CurPoint == Link then
      waypointVars.Effect3 = Effect3;  
    end;
  end;
  return waypointVars;
end;

Кусок игровой логики на Lua. Функция проверяет значение переменных в текущей точке пути моба.
Мы перебираем все точки пути и сравниваем с текущей точкой моба, но это не нужно, так как именно текущая точка в функцию и передаётся!

Запостил: hdkeeper hdkeeper, (Updated )

Комментарии (2) RSS

Добавить комментарий

Переведи на "PHP", guest!

    А не использовать ли нам bbcode?


    8