-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmbeddedLua.cs
More file actions
27 lines (26 loc) · 858 Bytes
/
EmbeddedLua.cs
File metadata and controls
27 lines (26 loc) · 858 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
namespace simplegame
{
// Dev-time hack to provide Lua scripts; ideally scripts would be read from a user submitted file or similar
class EmbeddedLua {
static public string DoNothing() => @"function player_turn(turn) turn.move(0,0) end";
static public string AttackOrMoveRight() => @"
function player_turn(turn)
if turn.isEnemyInRange == true then
turn.attack()
else
turn.move(1,0)
end
end";
static public string AttackOrMoveRandom() => @"
function player_turn(turn)
if turn.isEnemyInRange == true then
turn.attack()
else
local x = math.random(-1,1)
local y = math.random(-1,1)
turn.move(x,y)
end
end";
}
}