2024-12-08 02:52:59 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2024-12-08 04:55:59 +08:00
|
|
|
|
public class enemy : Role
|
2024-12-08 02:52:59 +08:00
|
|
|
|
{
|
|
|
|
|
public override void Start()
|
|
|
|
|
{
|
|
|
|
|
base.Start();
|
2024-12-09 23:24:46 +08:00
|
|
|
|
|
2024-12-08 04:55:59 +08:00
|
|
|
|
if (camp == Camp.Enemy)
|
|
|
|
|
{
|
2024-12-09 18:01:59 +08:00
|
|
|
|
//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
|
2024-12-09 23:24:46 +08:00
|
|
|
|
Init(InitEnenyData.instance.GetRandomWaypoints());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init(waypoints _waypoints)
|
|
|
|
|
{
|
|
|
|
|
base.Navigation.waypoints = _waypoints;
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
|
|
|
|
|
Navigation.MoveToNextWaypoint(this.gameObject);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void die()
|
|
|
|
|
{
|
|
|
|
|
if (Application.isPlaying)
|
2024-12-09 23:48:01 +08:00
|
|
|
|
{
|
2024-12-10 00:58:59 +08:00
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (SpawnPool.intance != null)
|
2024-12-10 06:57:53 +08:00
|
|
|
|
{
|
2024-12-11 17:08:26 +08:00
|
|
|
|
SkillBox.instance.UpdataExp(10);
|
2024-12-10 00:58:59 +08:00
|
|
|
|
SpawnPool.intance.ReturnEnemyToPool(this.gameObject); // <20><><EFBFBD>յ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>
|
2024-12-09 23:48:01 +08:00
|
|
|
|
ResetAllStatus();
|
2024-12-09 23:24:46 +08:00
|
|
|
|
}
|
2024-12-10 00:58:59 +08:00
|
|
|
|
|
|
|
|
|
UIContorl.instance.Killnumber += 1;
|
2024-12-08 04:55:59 +08:00
|
|
|
|
}
|
2024-12-08 02:52:59 +08:00
|
|
|
|
}
|
2024-12-09 23:48:01 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <20><><EFBFBD>ý<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>״̬
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void ResetAllStatus()
|
|
|
|
|
{
|
|
|
|
|
// <20><><EFBFBD><EFBFBD>Ѫ<EFBFBD><D1AA>
|
|
|
|
|
Hp = 100f;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Attack = 10f;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
|
|
|
|
physicalArmor = 10;
|
|
|
|
|
magicArmor = 5;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>õȼ<C3B5>
|
|
|
|
|
Level = 1;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ý<EFBFBD><C3BD><EFBFBD>
|
|
|
|
|
Gold = 10f;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD> Buff <20>б<EFBFBD>
|
|
|
|
|
buffList.Clear();
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9>ǰ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD>Ϊ
|
|
|
|
|
if (Navigation != null)
|
|
|
|
|
{
|
|
|
|
|
//Navigation.Stop(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Stop <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>ý<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>
|
|
|
|
|
animationHighlight = 0;
|
|
|
|
|
isAnimationPlay = false;
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD>壨<EFBFBD><E5A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (mycollider != null)
|
|
|
|
|
{
|
|
|
|
|
mycollider.enabled = true; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>õ<EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
}
|
2024-12-10 06:57:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("<22><><EFBFBD>뷶Χ<EBB7B6><CEA7><EFBFBD><EFBFBD>");
|
|
|
|
|
if (this.camp == Camp.Enemy && collision.tag == "House")
|
|
|
|
|
{
|
|
|
|
|
UIContorl.instance.Hp -= 1;
|
|
|
|
|
Destroy(this.gameObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-08 02:52:59 +08:00
|
|
|
|
}
|