proto_turn_based_rpg/Assets/Scripts/EnemyAi.cs

40 lines
895 B
C#

using System;
using UnityEngine;
using Random = System.Random;
public class EnemyAi
{
public Action attackCallback;
public Action defendCallback;
public Action counterCallback;
private Random rng;
public EnemyAi()
{
rng = new Random(1337);
}
// TODO: will need more information, not sure what info should be exposed.
public void TakeTurn()
{
var number = rng.Next(1, 4);
Debug.Log($"enemy rolled {number}");
switch (number)
{
case 1:
attackCallback();
break;
case 2:
defendCallback();
break;
case 3:
counterCallback();
break;
default:
Debug.LogWarning($"Enemy rolled something that it can't do {number}");
break;
}
}
}