108 lines
2.9 KiB
C#
108 lines
2.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DarkTonic.MasterAudio;
|
|
using DragonLi.Core;
|
|
using UnityEngine;
|
|
using Valheim;
|
|
|
|
public class EnemyBoss : Enemy
|
|
{
|
|
public BossState bossState = BossState.Sleep;
|
|
public Transform headRig;
|
|
public Transform leftHandRig;
|
|
public Transform rightHandRig;
|
|
|
|
public ParticleSystem attackEffectL;
|
|
public ParticleSystem attackEffectR;
|
|
|
|
public BoxCollider meshCollider;
|
|
|
|
public Move2Point move2Point;
|
|
|
|
public Vector3 initPos;
|
|
|
|
[Header("声音")]
|
|
[SoundGroup] public string attackRSound;
|
|
[SoundGroup] public string deadSound;
|
|
|
|
public void OnSpawn(EnemyData data, int areaId, int lvl, EnemyState state, Vector3 pos)
|
|
{
|
|
base.OnSpawn(data,areaId,lvl,state);
|
|
initPos = pos;
|
|
this.type = EnemyType.EnemyBoss;
|
|
bossState = BossState.WakeUp;
|
|
atkArea = 2.5f;
|
|
atk = data.Atk+(lvl-1)*data.Atk*0.1f;
|
|
health = data.Hp;
|
|
NavAgent.enabled = false;
|
|
behaviorTree.enabled = true;
|
|
behaviorTree.RegisterEvent("Move2Point", Move2Point);
|
|
}
|
|
|
|
public override void Die(object info, Transform _sender)
|
|
{
|
|
PlayAudioVecRpc(deadSound, transform);
|
|
GameManager.Ins.EnemyList.Remove(this);
|
|
NavAgent.enabled = false;
|
|
GameManager.Ins.WinArea(initPos);
|
|
//GameManager.Ins.IsWin = true;
|
|
//GameManager.Ins.ChangeGameBGM(Bgm.Win);
|
|
// for (int i = 0; i < MRNetworkManager.Ins.roomSlots.Count; i++)
|
|
// {
|
|
// StartCoroutine(GameManager.Ins.BallFlyToTree(MRNetworkManager.Ins.roomSlots[i], 10, 0.5F, GameInit.Ins.FakeTree.position));
|
|
// }
|
|
//弹出提示恭喜击败本地区怪物
|
|
//出现传送门 前往下一个地区
|
|
//小动物集体脱离玩家 删除全部小动物 转场场景打开
|
|
//gameManager清空怪物等级
|
|
}
|
|
|
|
public override void AttackOnce()
|
|
{
|
|
base.AttackOnce();
|
|
}
|
|
|
|
public void Move2Point()
|
|
{
|
|
/*move2Point.cb = () =>
|
|
{
|
|
|
|
};*/
|
|
Debug.Log("抵达终点");
|
|
move2Point.enabled = false;
|
|
RigidbodyComponent.isKinematic = true;
|
|
NavAgent.enabled = true;
|
|
|
|
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
|
|
{
|
|
Debug.Log("开始战斗");
|
|
bossState = BossState.Idle;
|
|
}, 0.1f);
|
|
move2Point.enabled = true;
|
|
bossState = BossState.Run2Stage;
|
|
}
|
|
|
|
public void FleeEvent()
|
|
{
|
|
GameManager.Ins.EnemyList.Remove(this);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 攻击特效
|
|
/// </summary>
|
|
public void AttackStart()
|
|
{
|
|
attackEffectR.Play();
|
|
MasterAudio.PlaySound3DAtVector3(attackRSound, rightHandRig.position);
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
base.Update();
|
|
}
|
|
public void EndSkill()
|
|
{
|
|
AnimatorComponent.SetBool("userSkill", false);
|
|
}
|
|
}
|
|
|