// Assigns the currentCharacter's actions // TODO: make this work for enemies of a general type rather than just enemyMeleeAI private void assignEnemyActions() { Character enemy = currentCharacter; //TODO integrate all this into just the enemyAI component and call one function there EnemyMeleeAI enemyAI = currentCharacter.GetComponent <EnemyMeleeAI>(); Character target = getClosestTarget(); while (enemy.CanMove()) { if (enemy.InRangeOfTarget(target)) { if (enemy.CanAttackTarget(target)) { enemy.QueueAttackTarget(target); } else { enemy.EndTurn(); } } else if (enemy.CanMove()) { List <Cell> pathToPlayer = enemyAI.GetWantedPath(target.GetCellLocation()); //getPathTowards(playerTarget.GetCellLocation(), enemy.getMovementDistance()); enemy.QueueMovementAction(pathToPlayer); } else { enemy.EndTurn(); } } }
void Start() { agent = GetComponent <NavMeshAgent>(); emAI = GetComponent <EnemyMeleeAI>(); erAI = GetComponent <EnemyRangeAI>(); frAI = GetComponent <FriendManager>(); agent.autoBraking = false; agent.speed = idleSpeed; town = GameObject.Find("DefenseTerrain").transform.GetChild(11); dropList = new Transform[25]; dropList[0] = nothing; dropList[1] = nothing; dropList[2] = shotgun; dropList[3] = nothing; dropList[4] = pistol; dropList[5] = nothing; dropList[6] = potion; dropList[7] = nothing; dropList[8] = pistol; dropList[9] = nothing; dropList[10] = shotgun; dropList[11] = nothing; dropList[12] = pistol; dropList[13] = nothing; dropList[14] = potion; dropList[15] = potion; dropList[16] = nothing; dropList[17] = pistol; dropList[18] = nothing; dropList[19] = rifle; dropList[20] = nothing; dropList[21] = pistol; dropList[22] = rifle; dropList[23] = nothing; dropList[24] = potion; dropList[24] = nothing; }