public BattleUnit FindUnitToAttack(Vector2 pos, uint team_index) { BattleUnit rel_unit = null; float min_hp = float.MaxValue; var neighbour_points = Pathfinder.GetPointNeighbours(pos, with_diagonal: true); foreach (var point in neighbour_points) { var tile_unit = GetTileUnit(point); if (tile_unit == null || tile_unit.GetTeamIndex() == team_index) { continue; } var hp = tile_unit.GetHP(); if (hp < min_hp) { min_hp = hp; rel_unit = tile_unit; } } return(rel_unit); }
public void SetTargetUnit(BattleUnit unit) => target_unit = unit;
public void ResetTargetUnit() => target_unit = null;
public void GiveDamage(BattleUnit enemy) { var damage = UnityEngine.Random.Range(DAMAGE_MIN, DAMAGE_MAX); enemy.GetDamage(damage); }