Files
beyond/Assets/Scripts/InvectorDerivatives/EnemyHealthScaler.cs
2024-11-20 15:21:28 +01:00

43 lines
1.3 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Invector.vCharacterController.AI;
using UnityEngine;
namespace Beyond
{
public class EnemyHealthScaler : MonoBehaviour
{
private vControlAIMelee m_aiController;
private float easyHealthScale = 0.7f;
private float normalHealthScale = 1f;
private float hardHealthScale = 1.4f;
void Start()
{
m_aiController = GetComponent<vControlAIMelee>();
float scale = 1f;
switch (GameStateManager.Instance.GameDifficulty)
{
case GameStateManager.Difficulty.EASY:
scale = easyHealthScale;
break;
case GameStateManager.Difficulty.NORMAL:
scale = normalHealthScale;
break;
case GameStateManager.Difficulty.HARD:
scale = hardHealthScale;
break;
}
if (m_aiController)
{
var maxHealth = m_aiController.maxHealth;
maxHealth = (int)((float) maxHealth * scale);
m_aiController.maxHealth = maxHealth;
m_aiController.ChangeHealth(maxHealth);
}
}
}
}