CapersProject/Assets/02.Scripts/Character/Enemy/Boss/SandMole/MiniSandMole.cs
Nam Tae Gun a5c3159335 버그 및 수정
+ SpineDamageableProps Idle이 반복하지 않는 현상 수정
+ 플레이어 체력이 부족할 때, Vignette 효과 줄이고, 쉽게 수정할 수 있게 변경
+ 보스 처치 후 일정시간 무적 효과 적용
+ MiniSandMole 죽지 않는 버그 수정
+ Bgm 3종 추가 및 BgmSo 수정
2024-06-24 18:54:47 +09:00

84 lines
2.8 KiB
C#

using Sirenix.OdinInspector;
using UnityEngine;
namespace BlueWater.Enemies.Bosses.SandMole
{
public class MiniSandMole : SandMole
{
// Variables
#region Variables
[Title("효과")]
[SerializeField]
private float _spawnDissolveTime = 2f;
//[SerializeField]
//private float _dieDissolveTime = 1f;
// Hashes
private static readonly int _dissolveValueHash = Shader.PropertyToID("_DissolveValue");
#endregion
// Initialize methods
#region Initialize methods
public override async void Initialize()
{
HitBoxCollider.enabled = false;
BossHealthPoint.Initialize(false, BossData.MaxHealthPoint,
BossData.DisplayName, SandMoleMapController.ParticleInstanceLocation);
BossSkillController.Initialize(BossData.SkillDataList);
SetMoveSpeed(SandMoleData.MoveSpeed);
StopMove();
MaterialPropertyBlock.SetFloat(_dissolveValueHash, 0f);
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
var elapsedTime = 0f;
while (elapsedTime <= _spawnDissolveTime)
{
var value = Mathf.Lerp(0f, 1f, elapsedTime / _spawnDissolveTime);
MaterialPropertyBlock.SetFloat(_dissolveValueHash, value);
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
elapsedTime += Time.deltaTime;
await Awaitable.NextFrameAsync();
}
MaterialPropertyBlock.SetFloat(_dissolveValueHash, 1f);
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
SpineController.SetSkin(SandMoleSkin.Normal.ToString());
var roarTrack = SpineController.PlayAnimation(SandMoleAnimation.Roar.ToString(), false);
await SpineController.WaitForAnimationCompletion(roarTrack);
BehaviorTree.EnableBehavior();
HitBoxCollider.enabled = true;
}
#endregion
// Methods
#region Methods
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);
await SpineController.WaitForAnimationCompletion(dieTrack);
Destroy(gameObject);
}
#endregion
}
}