[Fix] 충돌 스크립트 메인에서 가져옴
This commit is contained in:
parent
fcecd38c3f
commit
83dd8c6f94
@ -56,6 +56,10 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
Joystick = FindObjectOfType<FixedJoystick>();
|
Joystick = FindObjectOfType<FixedJoystick>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// isBattle 초기화 (임시)
|
||||||
|
bool isHousingScene = SceneManager.GetActiveScene().name.Contains("Housing");
|
||||||
|
_isBattle = !isHousingScene;
|
||||||
|
|
||||||
AssignCharacterController();
|
AssignCharacterController();
|
||||||
AssignAnimator();
|
AssignAnimator();
|
||||||
}
|
}
|
||||||
@ -67,13 +71,6 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
|
hitEffectController = GetComponentInChildren<PlayerHitEffectController>();
|
||||||
|
|
||||||
PlayerInit();
|
PlayerInit();
|
||||||
|
|
||||||
// isBattle 초기화 (임시)
|
|
||||||
/*bool isHousingScene = SceneManager.GetActiveScene().name.Contains("Housing");
|
|
||||||
_isBattle = !isHousingScene;
|
|
||||||
Debug.Log("_isBattle: " + _isBattle);*/
|
|
||||||
|
|
||||||
SwitchBattleMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -96,7 +93,9 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
|
|
||||||
// 공격 입력 처리
|
// 공격 입력 처리
|
||||||
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)
|
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)
|
||||||
&& (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead)) {
|
&& (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead))
|
||||||
|
{
|
||||||
|
GameManager.Instance.PlayPlayerAttackSound();
|
||||||
StartAttackAction();
|
StartAttackAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,13 +218,18 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void StartAttackAction() {
|
public void StartAttackAction()
|
||||||
|
{
|
||||||
|
if (!_isBattle) return;
|
||||||
|
|
||||||
_currentAction = _attackAction;
|
_currentAction = _attackAction;
|
||||||
_currentAction.StartAction(this);
|
_currentAction.StartAction(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartDashAction()
|
public void StartDashAction()
|
||||||
{
|
{
|
||||||
|
if (!_isBattle) return;
|
||||||
|
|
||||||
// 만약 공격 중이면 강제로 공격 종료
|
// 만약 공격 중이면 강제로 공격 종료
|
||||||
if (_currentAction == _attackAction && _attackAction.IsActive)
|
if (_currentAction == _attackAction && _attackAction.IsActive)
|
||||||
{
|
{
|
||||||
@ -400,6 +404,7 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
|||||||
if (character != this) return;
|
if (character != this) return;
|
||||||
if (CurrentState == PlayerState.Dead) return;
|
if (CurrentState == PlayerState.Dead) return;
|
||||||
|
|
||||||
|
GameManager.Instance.PlayPlayerHitSound();
|
||||||
SetState(PlayerState.Hit);
|
SetState(PlayerState.Hit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user