+ Item관련 Excel, Json, So 수정 + DropItemTable 로직 수정 + 아이템 프리팹에서 Enable Interaction 체크하면 직접 룻팅, 해제하면 자동 룻팅 + 체력회복 아이템 추가 + 개발자 메뉴 상호작용 "F1" 키를 통해 접근 가능 + 보스 맵은 마법진을 상호작용하면 보스전 시작 + 맵 안에서 교전 중일 때, 투명 벽 쉐이더 추가 + 맵 마다의 통로를 통해서 이동 가능 + 선형적인 맵 구조에 맞게 리소스 및 위치 수정 + 타이틀 화면으로 이동할 때 나타나는 오류 수정(CombatUiManager OnDisable 싱글톤 문제) Closes #25, #26
91 lines
3.7 KiB
C#
91 lines
3.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using BlueWater.Maps;
|
|
using BlueWater.Utility;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater.Enemies.Bosses.SandMole.Skills
|
|
{
|
|
public class MultiThrowSpikes : BaseSkill
|
|
{
|
|
private MultiThrowSpikesData _multiThrowSpikesData;
|
|
private SandMole _sandMole;
|
|
private AnimationController _animationController;
|
|
private Collider _targetCollider;
|
|
private Transform _particleInstantiateLocation;
|
|
|
|
protected override void BasicSetting()
|
|
{
|
|
if (!_sandMole)
|
|
{
|
|
_sandMole = SkillUser.GetComponent<SandMole>();
|
|
_animationController = _sandMole.AnimationController;
|
|
_targetCollider = _sandMole.Target;
|
|
_particleInstantiateLocation = MapManager.Instance.SandMoleMapController.ParticleInstanceLocation;
|
|
}
|
|
_multiThrowSpikesData = (MultiThrowSpikesData)SkillData;
|
|
|
|
base.BasicSetting();
|
|
}
|
|
|
|
public override void ActivateSkill(params Action[] actions)
|
|
{
|
|
Utils.StartUniqueCoroutine(this, ref SkillCoroutineInstance, SkillCoroutine(actions));
|
|
}
|
|
|
|
private IEnumerator SkillCoroutine(params Action[] actions)
|
|
{
|
|
EnableSkill = false;
|
|
_sandMole.StopMove();
|
|
_animationController.SetAnimationParameter("skillIndex", (int)SandMoleSkill.MultiThrowSpikes);
|
|
|
|
var animationStarted = false;
|
|
yield return StartCoroutine(_animationController.WaitForAnimationToRun("MultiThrowSpikes",
|
|
success => animationStarted = success));
|
|
|
|
if (!animationStarted || !SkillUser)
|
|
{
|
|
EndSkill(0, actions[0]);
|
|
yield break;
|
|
}
|
|
|
|
IsUsingSkill = true;
|
|
_animationController.ResetAnimationSpeed();
|
|
var startPosition = SkillUser.transform.position;
|
|
var waitForSeconds = new WaitForSeconds(_multiThrowSpikesData.SpikeInterval);
|
|
for (var i = 0; i < _multiThrowSpikesData.SpikeCount; i++)
|
|
{
|
|
if (!SkillUser || !_targetCollider)
|
|
{
|
|
EndSkill(SkillData.Cooldown, actions[0]);
|
|
yield break;
|
|
}
|
|
|
|
var targetCenterPosition = _targetCollider.bounds.center;
|
|
startPosition.y = targetCenterPosition.y;
|
|
var targetVector = targetCenterPosition - startPosition;
|
|
var targetDirection = targetVector.normalized;
|
|
_sandMole.CurrentDirection = targetDirection;
|
|
var rotation = Quaternion.LookRotation(targetDirection);
|
|
var projectile = Instantiate(_multiThrowSpikesData.SpikePrefab, startPosition, rotation,
|
|
_particleInstantiateLocation).GetComponent<ProjectileController>();
|
|
projectile.Initialize(_multiThrowSpikesData.Damage, _multiThrowSpikesData.TargetLayer);
|
|
projectile.AddForce(projectile.transform.forward * _multiThrowSpikesData.ProjectileSpeed, ForceMode.Impulse);
|
|
|
|
yield return waitForSeconds;
|
|
}
|
|
|
|
EndSkill(SkillData.Cooldown, actions[0]);
|
|
}
|
|
|
|
private void EndSkill(float cooldown, Action action)
|
|
{
|
|
Utils.EndUniqueCoroutine(this, ref SkillCoroutineInstance);
|
|
|
|
_animationController.SetAnimationParameter("skillIndex", (int)SandMoleSkill.None);
|
|
action?.Invoke();
|
|
|
|
Utils.StartUniqueCoroutine(this, ref CooldownCoroutineInstance,Utils.CoolDownCoroutine(cooldown, EndCooldown));
|
|
}
|
|
}
|
|
} |