using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; namespace RPG_Fight_Test.Assets.Scripts.Creatures { public class Skeleton : Creature { private List combatants; private void Start() { Dex = Random.Range(0, 20); movementRate = 20; CreatureHealth = Random.Range(10, 20); CurrentHealth = CreatureHealth; MaxHealth = CreatureHealth; IsCreatureAlive = true; } private void DecideFirstAction() { List closeEnemies = EnemiesInSquareNextToCreature(this, combatants); if (closeEnemies.Count > 0) { SetFirstAction(new AttackAction(closeEnemies[0])); } else { // Move towards closest enemy Creature closestEnemy = FindClosestEnemy(this, combatants); MoveAction action = new MoveAction(); action.SetStartPosition(CurrentPos); action.SetTargetCreature(closestEnemy); action.SetCreatureToMove(this); SetFirstAction(action); } } // Just a copy of first action for now, should have its own logic private void DecideSecondAction() { List closeEnemies = EnemiesInSquareNextToCreature(this, combatants); if (closeEnemies.Count > 0) { SetSecondAction(new AttackAction(closeEnemies[0])); } else { // Move towards closest enemy Creature closestEnemy = FindClosestEnemy(this, combatants); MoveAction action = new MoveAction(); action.SetStartPosition(CurrentPos); action.SetTargetCreature(closestEnemy); action.SetCreatureToMove(this); SetSecondAction(action); } } public void DecideActions(List combatants) { this.combatants = combatants; List closeEnemies = EnemiesInSquareNextToCreature(this, combatants); DecideFirstAction(); DecideSecondAction(); Debug.Log("Number of close enemies " + closeEnemies.Count); } public void ShowInfo() { } } }