2024-06-23 09:38:19 +00:00
|
|
|
|
using Sirenix.OdinInspector;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace BlueWater.Enemies.Bosses.SandMole
|
|
|
|
|
{
|
2024-06-23 09:38:19 +00:00
|
|
|
|
public class MiniSandMole : SandMole
|
2024-06-16 11:09:42 +00:00
|
|
|
|
{
|
|
|
|
|
// Variables
|
|
|
|
|
#region Variables
|
|
|
|
|
[Title("효과")]
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private float _spawnDissolveTime = 2f;
|
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
//[SerializeField]
|
|
|
|
|
//private float _dieDissolveTime = 1f;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
|
|
|
|
|
// Hashes
|
|
|
|
|
private static readonly int _dissolveValueHash = Shader.PropertyToID("_DissolveValue");
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// Initialize methods
|
|
|
|
|
#region Initialize methods
|
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
public override async void Initialize()
|
2024-06-16 11:09:42 +00:00
|
|
|
|
{
|
2024-06-23 19:52:28 +00:00
|
|
|
|
HitBoxCollider.enabled = false;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
BossHealthPoint.Initialize(false, BossData.MaxHealthPoint,
|
2024-06-23 09:38:19 +00:00
|
|
|
|
BossData.DisplayName, SandMoleMapController.ParticleInstanceLocation);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
BossSkillController.Initialize(BossData.SkillDataList);
|
2024-06-23 09:38:19 +00:00
|
|
|
|
SetMoveSpeed(SandMoleData.MoveSpeed);
|
|
|
|
|
StopMove();
|
|
|
|
|
|
2024-06-23 19:52:28 +00:00
|
|
|
|
MaterialPropertyBlock.SetFloat(_dissolveValueHash, 0f);
|
|
|
|
|
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
var elapsedTime = 0f;
|
|
|
|
|
while (elapsedTime <= _spawnDissolveTime)
|
|
|
|
|
{
|
|
|
|
|
var value = Mathf.Lerp(0f, 1f, elapsedTime / _spawnDissolveTime);
|
2024-06-23 19:52:28 +00:00
|
|
|
|
MaterialPropertyBlock.SetFloat(_dissolveValueHash, value);
|
|
|
|
|
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
elapsedTime += Time.deltaTime;
|
2024-06-23 09:38:19 +00:00
|
|
|
|
await Awaitable.NextFrameAsync();
|
2024-06-16 11:09:42 +00:00
|
|
|
|
}
|
2024-06-23 19:52:28 +00:00
|
|
|
|
MaterialPropertyBlock.SetFloat(_dissolveValueHash, 1f);
|
|
|
|
|
MeshRenderer.SetPropertyBlock(MaterialPropertyBlock);
|
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
SpineController.SetSkin(SandMoleSkin.Normal.ToString());
|
|
|
|
|
var roarTrack = SpineController.PlayAnimation(SandMoleAnimation.Roar.ToString(), false);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
await SpineController.WaitForAnimationCompletion(roarTrack);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
BehaviorTree.EnableBehavior();
|
2024-06-23 19:52:28 +00:00
|
|
|
|
HitBoxCollider.enabled = true;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
|
#region Methods
|
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
protected override async void Die()
|
2024-06-16 11:09:42 +00:00
|
|
|
|
{
|
2024-06-23 09:38:19 +00:00
|
|
|
|
BossSkillController.StopAllCoroutine();
|
2024-06-24 09:54:47 +00:00
|
|
|
|
SandMoleStatus.StopAllCoroutine();
|
2024-06-23 09:38:19 +00:00
|
|
|
|
BehaviorTree.DisableBehavior();
|
|
|
|
|
StopMove();
|
2024-06-16 11:09:42 +00:00
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
HitBoxCollider.enabled = false;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
if (Rigidbody)
|
|
|
|
|
{
|
2024-06-23 09:38:19 +00:00
|
|
|
|
Rigidbody.linearVelocity = Vector3.zero;
|
2024-06-16 11:09:42 +00:00
|
|
|
|
Rigidbody.isKinematic = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
SpineController.SetSkin(SandMoleSkin.Idle.ToString());
|
|
|
|
|
var dieTrack = SpineController.PlayAnimation(SandMoleAnimation.Die.ToString(), false);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
|
2024-06-23 09:38:19 +00:00
|
|
|
|
await SpineController.WaitForAnimationCompletion(dieTrack);
|
2024-06-16 11:09:42 +00:00
|
|
|
|
Destroy(gameObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|