// Attack Controls public void PlayerRangedAttack(float damage) { if (battle_Control.selectedCharacter != null) { // Stop displaying cursor StopCoroutine("PathCursorDisplay"); if (pathEnd_cursor != null) { ObjectPool.instance.PoolObject(pathEnd_cursor); } // Do Damage if (Mouse_Controller.Instance.EnemyUnderMouse != null) { currTargetEnemy = Mouse_Controller.Instance.EnemyUnderMouse; DamageEnemy(10, currTargetEnemy); } // Subtract AP Player_ChargeActionPoints(); // Set a new Enemy Target if it doesn't have one already Enemy_BattleController.Instance.SetTarget(battle_Control.selectedCharacter); // End Action to check for end of turn EndAction(); } }
void DamageEnemy(float damage, Enemy_Handler enemy) { if (enemy != null && enemy.gameObject.activeSelf) { enemy.TakeDamage(damage); Debug.Log(enemy.myChar.Name + " takes " + damage + " damage!"); } }
public void SetNewNPCPosition(Vector2 newPos, Enemy_Handler NPC) { if (!NPCPositionsMap.ContainsKey(newPos)) { NPCPositionsMap.Add(newPos, NPC); Debug.Log("BATTLE CONTROL: Set new NPC position at " + newPos); } }
public void ReSetNPCPosition(Vector2 oldPos, Vector2 newPos, Enemy_Handler NPC) { if (NPCPositionsMap.ContainsKey(oldPos)) { NPCPositionsMap.Remove(oldPos); Debug.Log("BATTLE CONTROL: Removed NPC position at " + oldPos); SetNewNPCPosition(newPos, NPC); } else { SetNewNPCPosition(newPos, NPC); } }