+ SpineDamageableProps Idle이 반복하지 않는 현상 수정 + 플레이어 체력이 부족할 때, Vignette 효과 줄이고, 쉽게 수정할 수 있게 변경 + 보스 처치 후 일정시간 무적 효과 적용 + MiniSandMole 죽지 않는 버그 수정 + Bgm 3종 추가 및 BgmSo 수정
173 lines
4.9 KiB
C#
173 lines
4.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BlueWater.Items;
|
|
using BlueWater.Maps;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater.Enemies.Bosses.SandMole
|
|
{
|
|
public enum SandMoleSkill
|
|
{
|
|
None = 0,
|
|
GateOfSpikes,
|
|
MultiThrowSpikes,
|
|
SingleRoll,
|
|
SpikeBarrage
|
|
}
|
|
|
|
public enum SandMoleSkin
|
|
{
|
|
Idle = 0,
|
|
Normal,
|
|
Spin
|
|
}
|
|
|
|
public enum SandMoleAnimation
|
|
{
|
|
None = 0,
|
|
Die,
|
|
DigIn,
|
|
DigOut,
|
|
Idle,
|
|
Roar,
|
|
Spin,
|
|
SpinReady,
|
|
SpinReady2,
|
|
Stun
|
|
}
|
|
|
|
public class SandMole : SpineBoss
|
|
{
|
|
// Variables
|
|
#region Variables
|
|
|
|
[field: Title("SandMole 컴포넌트")]
|
|
[field: SerializeField, Required]
|
|
public SandMoleStatus SandMoleStatus { get; private set; }
|
|
|
|
private List<SummonMiniSandMole> _summonMiniSandMoles;
|
|
|
|
public SandMoleData SandMoleData { get; private set; }
|
|
public SandMoleMapController SandMoleMapController { get; private set; }
|
|
|
|
#endregion
|
|
|
|
// Unity events
|
|
#region Unity events
|
|
|
|
protected override void Update()
|
|
{
|
|
base.Update();
|
|
|
|
HandleMovement();
|
|
FlipVisualLook();
|
|
}
|
|
|
|
protected override void OnDestroy()
|
|
{
|
|
base.OnDestroy();
|
|
|
|
BossHealthPoint.OnHealthChanged -= SummonMiniSandMole;
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Initialize methods
|
|
#region Initialize methods
|
|
|
|
protected override void InitializeComponents()
|
|
{
|
|
base.InitializeComponents();
|
|
|
|
SandMoleStatus = GetComponent<SandMoleStatus>();
|
|
SandMoleData = BossData as SandMoleData;
|
|
if (SandMoleData != null)
|
|
{
|
|
_summonMiniSandMoles = SandMoleData.SummonMiniSandMoles.ConvertAll(mole => new SummonMiniSandMole(mole));
|
|
}
|
|
SandMoleMapController = MapManager.Instance.SandMoleMapController;
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
StartCoroutine(InitializeCoroutine());
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Methods
|
|
#region Methods
|
|
|
|
private IEnumerator InitializeCoroutine()
|
|
{
|
|
HitBoxCollider.enabled = false;
|
|
BossHealthPoint.Initialize(true, SandMoleData.MaxHealthPoint,
|
|
SandMoleData.DisplayName, SandMoleMapController.ParticleInstanceLocation);
|
|
BossHealthPoint.OnHealthChanged += SummonMiniSandMole;
|
|
BossSkillController.Initialize(BossData.SkillDataList);
|
|
SetMoveSpeed(SandMoleData.MoveSpeed);
|
|
StopMove();
|
|
|
|
SpineController.SetSkin(SandMoleSkin.Normal.ToString());
|
|
var isCameraShakeActive = false;
|
|
var roarTrack = SpineController.PlayAnimation(SandMoleAnimation.Roar.ToString(), false);
|
|
while (!roarTrack.IsComplete)
|
|
{
|
|
if (CurrentHealthPoint == 0) yield break;
|
|
|
|
if (roarTrack.TrackTime >= 1f && !isCameraShakeActive)
|
|
{
|
|
VisualFeedbackManager.Instance.CameraShake(CombatCameraManager.Instance.BaseCombatCamera, 2f, 1f);
|
|
isCameraShakeActive = true;
|
|
}
|
|
|
|
yield return null;
|
|
}
|
|
|
|
BehaviorTree.EnableBehavior();
|
|
HitBoxCollider.enabled = true;
|
|
}
|
|
|
|
protected override async void Die()
|
|
{
|
|
BossSkillController.StopAllCoroutine();
|
|
SandMoleStatus.StopAllCoroutine();
|
|
BehaviorTree.DisableBehavior();
|
|
StopMove();
|
|
|
|
HitBoxCollider.enabled = false;
|
|
if (Rigidbody)
|
|
{
|
|
Rigidbody.linearVelocity = Vector3.zero;
|
|
Rigidbody.isKinematic = true;
|
|
}
|
|
|
|
SpineController.SetSkin(SandMoleSkin.Idle.ToString());
|
|
var dieTrack = SpineController.PlayAnimation(SandMoleAnimation.Die.ToString(), false);
|
|
SandMoleMapController.ClearMap(gameObject);
|
|
|
|
await SpineController.WaitForAnimationCompletion(dieTrack);
|
|
ItemManager.Instance.ItemDropRandomPosition(BossData.CharacterIdx, transform.position);
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
private void SummonMiniSandMole(int currentHp)
|
|
{
|
|
if (currentHp == 0) return;
|
|
|
|
var currentHealthPercentage = (float)currentHp / BossData.MaxHealthPoint * 100f;
|
|
|
|
foreach (var element in _summonMiniSandMoles)
|
|
{
|
|
if (currentHealthPercentage > element.HealthPercentage || element.SummonTrigger) continue;
|
|
|
|
SandMoleMapController.SummonMiniSandMole();
|
|
element.SummonTrigger = true;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |