40 lines
908 B
C#
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); // 回收当前敌人到池中
|
|
}
|
|
}
|
|
}
|
|
}
|