Cute_demon_attacks/meng_yao/Assets/script/A_Fight/enemy.cs
2024-12-09 23:24:46 +08:00

40 lines
908 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enemy : Role
{
public override void Start()
{
base.Start();
if (camp == Camp.Enemy)
{
//开始移动
Init(InitEnenyData.instance.GetRandomWaypoints());
}
}
public void Init(waypoints _waypoints)
{
base.Navigation.waypoints = _waypoints;
//开始移动
Navigation.MoveToNextWaypoint(this.gameObject);
}
public override void die()
{
if (Application.isPlaying)
{
// 将当前敌人对象放入死亡池
SpawnPool spawnPool = Base.GlobalObj.GetComponent<SpawnPool>(); // 获取 SpawnPool 组件
if (spawnPool != null)
{
spawnPool.ReturnEnemyToPool(this.gameObject); // 回收当前敌人到池中
}
}
}
}