Aimbot-PPO/Aimbot-PPO-MultiScene/Assets/Script/InGame/Enemy.cs
Koha9 885dbb92e9 Add Enemy Change Button
Add Enemy Change Button. Tidy up Unity Script folder.
2022-09-06 23:01:55 +09:00

41 lines
804 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
float EnemyHP = 100;
public float EnemyMaxHP = 100;
void Start()
{
EnemyHP = EnemyMaxHP;
}
// Update is called once per frame
void Update()
{
detactDeath();
}
private void detactDeath()
{
if (EnemyHP <= 0){
Destroy(this.gameObject);
}
}
public void ReactToHit(float Damage,GameObject damageSource)
{
EnemyHP -= Damage;
Debug.Log("HP:"+ EnemyHP);
if(EnemyHP <= 0)
{
damageSource.GetComponent<AgentWithGun>().GotKill();
Destroy(this.gameObject);
}
}
public float getnowHP()
{
return EnemyHP;
}
}