+ 스파인 오브젝트에 커스텀 Material 추가 및 MaterialPropertyBlock 방식 추가 + 개발자 키(F3) 전투플레이어 체력 회복 기능 추가 + SandMole Spike 파티클 변경 + 맵 이동할 때, 재시작할 때, 보스 체력 바 제거
83 lines
2.8 KiB
C#
83 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();
|
|
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
|
|
}
|
|
} |