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
|
|
|
|
{
|
2024-12-13 22:29:17 +08:00
|
|
|
|
public string enemyId;
|
2024-12-18 16:55:26 +08:00
|
|
|
|
[Header("<22>ƶ<EFBFBD><C6B6>ٶ<EFBFBD>")] public float moveSpeed;
|
2024-12-13 22:29:17 +08:00
|
|
|
|
|
|
|
|
|
[HideInInspector]
|
|
|
|
|
public float harmNumber=0;//<2F>˺<EFBFBD>
|
|
|
|
|
|
2024-12-14 23:20:55 +08:00
|
|
|
|
|
2024-12-13 22:29:17 +08:00
|
|
|
|
public float HarmNumber
|
|
|
|
|
{
|
|
|
|
|
get=> harmNumber;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
harmNumber=value;
|
|
|
|
|
Debug.Log(enemyId+"<22><><EFBFBD>˺<EFBFBD>"+ harmNumber );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-08 02:52:59 +08:00
|
|
|
|
public override void Start()
|
|
|
|
|
{
|
|
|
|
|
base.Start();
|
2024-12-18 16:55:26 +08:00
|
|
|
|
|
|
|
|
|
// AnimationTree[0].CharacterAnimationFrameInterval =(int)moveSpeed * 4;
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
2024-12-13 22:29:17 +08:00
|
|
|
|
|
|
|
|
|
|
2024-12-09 23:24:46 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Init(waypoints _waypoints)
|
|
|
|
|
{
|
|
|
|
|
base.Navigation.waypoints = _waypoints;
|
|
|
|
|
|
|
|
|
|
//<2F><>ʼ<EFBFBD>ƶ<EFBFBD>
|
2024-12-18 16:55:26 +08:00
|
|
|
|
Navigation.MoveToNextWaypoint(this.gameObject,moveSpeed);
|
2024-12-09 23:24:46 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void die()
|
|
|
|
|
{
|
2024-12-14 21:15:57 +08:00
|
|
|
|
base.die();
|
2024-12-09 23:24:46 +08:00
|
|
|
|
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>
|
2024-12-14 21:15:57 +08:00
|
|
|
|
if (SpawnPool.intance != null )
|
2024-12-10 06:57:53 +08:00
|
|
|
|
{
|
2024-12-14 23:20:55 +08:00
|
|
|
|
|
|
|
|
|
SkillBox.instance.AddExperience(6,this.gameObject.transform);
|
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
|
|
|
|
|
2024-12-14 21:15:57 +08:00
|
|
|
|
|
2024-12-10 06:57:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void OnTriggerEnter2D(Collider2D collision)
|
|
|
|
|
{
|
2024-12-12 23:04:13 +08:00
|
|
|
|
// Debug.Log("<22><><EFBFBD>뷶Χ<EBB7B6><CEA7><EFBFBD><EFBFBD>");
|
2024-12-10 06:57:53 +08:00
|
|
|
|
if (this.camp == Camp.Enemy && collision.tag == "House")
|
|
|
|
|
{
|
|
|
|
|
UIContorl.instance.Hp -= 1;
|
|
|
|
|
Destroy(this.gameObject);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-12-08 02:52:59 +08:00
|
|
|
|
}
|