Merge branch 'main' into DEG-85-메인화면-UI-구현
This commit is contained in:
commit
ffa81ded6f
@ -30,12 +30,6 @@ public class EnemyControllerEditor : Editor
|
||||
case EnemyState.Attack:
|
||||
GUI.backgroundColor = new Color(1, 1, 0, 1f);
|
||||
break;
|
||||
case EnemyState.Move:
|
||||
GUI.backgroundColor = new Color(0, 1, 1, 1f);
|
||||
break;
|
||||
case EnemyState.GetHit:
|
||||
GUI.backgroundColor = new Color(0.1f, 0.1f, 0.1f, 1f);
|
||||
break;
|
||||
case EnemyState.Dead:
|
||||
GUI.backgroundColor = new Color(1, 0, 0, 1f);
|
||||
break;
|
||||
@ -55,12 +49,10 @@ public class EnemyControllerEditor : Editor
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Idle")) enemyController.SetState(EnemyState.Idle);
|
||||
if (GUILayout.Button("Trace")) enemyController.SetState(EnemyState.Trace);
|
||||
if (GUILayout.Button("Attack")) enemyController.SetState(EnemyState.Attack);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Move")) enemyController.SetState(EnemyState.Move);
|
||||
if (GUILayout.Button("GetHit")) enemyController.SetState(EnemyState.GetHit);
|
||||
if (GUILayout.Button("Attack")) enemyController.SetState(EnemyState.Attack);
|
||||
if (GUILayout.Button("Dead")) enemyController.SetState(EnemyState.Dead);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
BIN
Assets/JAY/Animation/Attack04.anim
(Stored with Git LFS)
BIN
Assets/JAY/Animation/Attack04.anim
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JAY/Animation/Dead.anim
(Stored with Git LFS)
Normal file
BIN
Assets/JAY/Animation/Dead.anim
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/JAY/Animation/Dead.anim.meta
Normal file
8
Assets/JAY/Animation/Dead.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26572f377ac934546b30d6d9e0cab051
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JAY/Animation/UpperBody_Passthrough.anim
(Stored with Git LFS)
Normal file
BIN
Assets/JAY/Animation/UpperBody_Passthrough.anim
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/JAY/Animation/UpperBody_Passthrough.anim.meta
Normal file
8
Assets/JAY/Animation/UpperBody_Passthrough.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5caba6316080f564091600905868fb66
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
109
Assets/JAY/Animation/WholeBody.mask
Normal file
109
Assets/JAY/Animation/WholeBody.mask
Normal file
@ -0,0 +1,109 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!319 &31900000
|
||||
AvatarMask:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: WholeBody
|
||||
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
|
||||
m_Elements:
|
||||
- m_Path:
|
||||
m_Weight: 1
|
||||
- m_Path: Body05
|
||||
m_Weight: 1
|
||||
- m_Path: Eye01
|
||||
m_Weight: 1
|
||||
- m_Path: Hair01
|
||||
m_Weight: 1
|
||||
- m_Path: Head01_Male
|
||||
m_Weight: 1
|
||||
- m_Path: Mouth01
|
||||
m_Weight: 1
|
||||
- m_Path: root
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/BackpackBone
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/shoulderPadJoint_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/index_01_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/index_01_l/index_02_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/index_01_l/index_02_l/index_03_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/thumb_01_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/thumb_01_l/thumb_02_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/thumb_01_l/thumb_02_l/thumb_03_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_l/upperarm_l/lowerarm_l/hand_l/weapon_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/shoulderPadJoint_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/index_01_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/index_01_r/index_02_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/index_01_r/index_02_r/index_03_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/thumb_01_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/thumb_01_r/thumb_02_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/thumb_01_r/thumb_02_r/thumb_03_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/clavicle_r/upperarm_r/lowerarm_r/hand_r/weapon_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/CloakBone01
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/CloakBone01/CloakBone02
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/CloakBone01/CloakBone02/CloakBone03
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/neck_01
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/spine_01/spine_02/spine_03/neck_01/head
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_l/calf_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_l/calf_l/foot_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_l/calf_l/foot_l/ball_l
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_r/calf_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_r/calf_r/foot_r
|
||||
m_Weight: 1
|
||||
- m_Path: root/pelvis/thigh_r/calf_r/foot_r/ball_r
|
||||
m_Weight: 1
|
8
Assets/JAY/Animation/WholeBody.mask.meta
Normal file
8
Assets/JAY/Animation/WholeBody.mask.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6593ee38fd371db459652c920630d2c9
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 31900000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JAY/Animation/Win.anim
(Stored with Git LFS)
Normal file
BIN
Assets/JAY/Animation/Win.anim
(Stored with Git LFS)
Normal file
Binary file not shown.
8
Assets/JAY/Animation/Win.anim.meta
Normal file
8
Assets/JAY/Animation/Win.anim.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3b0144fdb439d941b9e9014a1635178
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 7400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JAY/Animator/PlayerController.controller
(Stored with Git LFS)
BIN
Assets/JAY/Animator/PlayerController.controller
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JAY/HousingUI.unity
(Stored with Git LFS)
BIN
Assets/JAY/HousingUI.unity
(Stored with Git LFS)
Binary file not shown.
56
Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs
Normal file
56
Assets/JAY/Scripts/IPlayerAction/PlayerActionDash.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerActionDash : IPlayerAction
|
||||
{
|
||||
private PlayerController player;
|
||||
private float duration = 0.25f; // 대시 유지 시간
|
||||
private float timer; // 대시 경과 시간
|
||||
private Vector3 direction; // 대시 방향
|
||||
|
||||
private float dashSpeedMultiplier = 3f; // 기본 이동 속도의 n배
|
||||
private float dashSpeed; // 실제 대시 속도(계산한 값)
|
||||
|
||||
public bool IsActive { get; private set; } // 현재 대시 중인지 여부
|
||||
|
||||
public void StartAction(PlayerController player)
|
||||
{
|
||||
this.player = player;
|
||||
IsActive = true;
|
||||
timer = 0f;
|
||||
|
||||
// 조이스틱 입력값 있으면 그 방향, 없으면 캐릭터가 바라보는 방향
|
||||
direction = player.GetMoveDirectionOrForward().normalized;
|
||||
|
||||
// 대시 속도 = 이동 속도 x 배수
|
||||
dashSpeed = player.moveSpeed * dashSpeedMultiplier;
|
||||
|
||||
// TODO: 필요 시 애니메이션 재생
|
||||
// player.PlayerAnimator.SetTrigger("Roll");
|
||||
}
|
||||
|
||||
public void UpdateAction()
|
||||
{
|
||||
if (!IsActive) return;
|
||||
|
||||
DoDash();
|
||||
}
|
||||
|
||||
private void DoDash()
|
||||
{
|
||||
timer += Time.deltaTime;
|
||||
if (timer < duration)
|
||||
{
|
||||
player.CharacterController.Move(direction * dashSpeed * Time.deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
|
||||
public void EndAction()
|
||||
{
|
||||
IsActive = false;
|
||||
player = null;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eceb0c738c2c4690b8b4dd02e10c7df4
|
||||
timeCreated: 1745459840
|
@ -3,7 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public enum PlayerState { None, Idle, Move, Hit, Dead }
|
||||
public enum PlayerState { None, Idle, Move, Win, Hit, Dead }
|
||||
|
||||
public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
{
|
||||
@ -17,18 +17,22 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
private GameObject weapon;
|
||||
private WeaponController _weaponController;
|
||||
|
||||
private IPlayerState CurrentStateClass { get; set; }
|
||||
private IPlayerAction currentAction;
|
||||
private IPlayerState _currentStateClass { get; set; }
|
||||
private IPlayerAction _currentAction;
|
||||
public IPlayerAction CurrentAction => _currentAction;
|
||||
|
||||
// 상태 관련
|
||||
private PlayerStateIdle _playerStateIdle;
|
||||
private PlayerStateMove _playerStateMove;
|
||||
private PlayerStateWin _playerStateWin;
|
||||
private PlayerStateDead _playerStateDead;
|
||||
|
||||
// 행동 관련
|
||||
private PlayerActionAttack attackAction;
|
||||
private PlayerActionAttack _attackAction;
|
||||
private PlayerActionDash _actionDash;
|
||||
|
||||
// 외부에서도 사용하는 변수
|
||||
public FixedJoystick joystick { get; private set; }
|
||||
public FixedJoystick Joystick { get; private set; }
|
||||
public PlayerState CurrentState { get; private set; }
|
||||
private Dictionary<PlayerState, IPlayerState> _playerStates;
|
||||
public Animator PlayerAnimator { get; private set; }
|
||||
@ -38,9 +42,9 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
{
|
||||
PlayerAnimator = GetComponent<Animator>();
|
||||
_characterController = GetComponent<CharacterController>();
|
||||
if (joystick == null)
|
||||
if (Joystick == null)
|
||||
{
|
||||
joystick = FindObjectOfType<FixedJoystick>();
|
||||
Joystick = FindObjectOfType<FixedJoystick>();
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,14 +55,19 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
// 상태 초기화
|
||||
_playerStateIdle = new PlayerStateIdle();
|
||||
_playerStateMove = new PlayerStateMove();
|
||||
_playerStateWin = new PlayerStateWin();
|
||||
_playerStateDead = new PlayerStateDead();
|
||||
|
||||
_playerStates = new Dictionary<PlayerState, IPlayerState>
|
||||
{
|
||||
{ PlayerState.Idle, _playerStateIdle },
|
||||
{ PlayerState.Move, _playerStateMove },
|
||||
{ PlayerState.Win, _playerStateWin },
|
||||
{ PlayerState.Dead, _playerStateDead },
|
||||
};
|
||||
|
||||
attackAction = new PlayerActionAttack();
|
||||
_attackAction = new PlayerActionAttack();
|
||||
_actionDash = new PlayerActionDash();
|
||||
|
||||
PlayerInit();
|
||||
}
|
||||
@ -70,20 +79,23 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
_playerStates[CurrentState].Update();
|
||||
}
|
||||
|
||||
// 현재 액션이 활성화 되어 있으면 Update 호출
|
||||
if (currentAction != null && currentAction.IsActive) {
|
||||
currentAction.UpdateAction();
|
||||
// 대시 우선 입력 처리
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
StartDashAction();
|
||||
return;
|
||||
}
|
||||
|
||||
// 공격 입력 처리
|
||||
if (Input.GetKeyDown(KeyCode.X) && (currentAction == null || !currentAction.IsActive)) {
|
||||
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)) {
|
||||
StartAttackAction();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartAttackAction() {
|
||||
currentAction = attackAction;
|
||||
currentAction.StartAction(this);
|
||||
// 액션 업데이트
|
||||
if (_currentAction != null && _currentAction.IsActive)
|
||||
{
|
||||
_currentAction.UpdateAction();
|
||||
}
|
||||
}
|
||||
|
||||
#region 초기화 관련
|
||||
@ -109,6 +121,8 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
|
||||
#endregion
|
||||
|
||||
#region 상태, 동작 변화 관련
|
||||
|
||||
public void SetState(PlayerState state)
|
||||
{
|
||||
if (CurrentState != PlayerState.None)
|
||||
@ -116,10 +130,36 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
_playerStates[CurrentState].Exit();
|
||||
}
|
||||
CurrentState = state;
|
||||
CurrentStateClass = _playerStates[state];
|
||||
CurrentStateClass.Enter(this);
|
||||
_currentStateClass = _playerStates[state];
|
||||
_currentStateClass.Enter(this);
|
||||
}
|
||||
|
||||
|
||||
public void StartAttackAction() {
|
||||
_currentAction = _attackAction;
|
||||
_currentAction.StartAction(this);
|
||||
}
|
||||
|
||||
public void StartDashAction()
|
||||
{
|
||||
// 만약 공격 중이면 강제로 공격 종료
|
||||
if (_currentAction == _attackAction && _attackAction.IsActive)
|
||||
{
|
||||
_attackAction.EndAction(); // 애니메이션도 중단
|
||||
}
|
||||
|
||||
// 기존 대시 중이면 중복 실행 안 함
|
||||
if (_actionDash.IsActive)
|
||||
return;
|
||||
|
||||
_currentAction = _actionDash;
|
||||
_actionDash.StartAction(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 공격 관련
|
||||
|
||||
public void SwitchBattleMode()
|
||||
{
|
||||
_isBattle = !_isBattle;
|
||||
@ -130,25 +170,43 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
public void SetAttackComboTrue() {
|
||||
if (_weaponController.IsAttacking) return; // 이미 공격 중이면 실행 안함
|
||||
|
||||
if (currentAction == attackAction) {
|
||||
attackAction.EnableCombo();
|
||||
if (_currentAction == _attackAction) {
|
||||
_attackAction.EnableCombo();
|
||||
_weaponController.AttackStart();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetAttackComboFalse() {
|
||||
if (currentAction == attackAction) {
|
||||
attackAction.DisableCombo();
|
||||
if (_currentAction == _attackAction) {
|
||||
_attackAction.DisableCombo();
|
||||
_weaponController.AttackEnd();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 대시 관련
|
||||
|
||||
public Vector3 GetMoveDirectionOrForward()
|
||||
{
|
||||
Vector3 dir = new Vector3(Joystick.Horizontal, 0, Joystick.Vertical);
|
||||
return dir.sqrMagnitude > 0.01f ? dir.normalized : transform.forward;
|
||||
}
|
||||
|
||||
public void DashButtonPressed()
|
||||
{
|
||||
if (!_actionDash.IsActive)
|
||||
{
|
||||
StartDashAction();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IObserver 관련
|
||||
|
||||
public void OnNext(GameObject value)
|
||||
{
|
||||
Debug.Log("무기 타격");
|
||||
float playerAttackPower = _weaponController.AttackPower * attackPower; // 플레이어 공격 데미지(막타는 일반 데미지의 4배)
|
||||
}
|
||||
|
||||
public void OnError(Exception error)
|
||||
@ -161,4 +219,5 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ public class PlayerControllerEditor : Editor
|
||||
|
||||
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
EditorGUILayout.LabelField("현재 상태", playerController.CurrentState.ToString(), EditorStyles.boldLabel);
|
||||
EditorGUILayout.LabelField("현재 행동", playerController.CurrentAction != null ? playerController.CurrentAction.ToString() : "-", EditorStyles.boldLabel);
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
|
||||
@ -38,10 +39,12 @@ public class PlayerControllerEditor : Editor
|
||||
|
||||
if (GUILayout.Button("BattleMode"))
|
||||
playerController.SwitchBattleMode();
|
||||
if (GUILayout.Button("Win"))
|
||||
playerController.SetState(PlayerState.Win);
|
||||
// if (GUILayout.Button("Hit"))
|
||||
// playerController.SetState(PlayerState.Hit);
|
||||
// if (GUILayout.Button("Dead"))
|
||||
// playerController.SetState(PlayerState.Dead);
|
||||
if (GUILayout.Button("Dead"))
|
||||
playerController.SetState(PlayerState.Dead);
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
22
Assets/JAY/Scripts/PlayerState/PlayerStateDead.cs
Normal file
22
Assets/JAY/Scripts/PlayerState/PlayerStateDead.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerStateDead : IPlayerState
|
||||
{
|
||||
private PlayerController _playerController;
|
||||
|
||||
public void Enter(PlayerController playerController)
|
||||
{
|
||||
_playerController = playerController;
|
||||
_playerController.PlayerAnimator.SetBool("Dead", true);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
_playerController.PlayerAnimator.SetBool("Dead", false);
|
||||
_playerController = null;
|
||||
}
|
||||
}
|
3
Assets/JAY/Scripts/PlayerState/PlayerStateDead.cs.meta
Normal file
3
Assets/JAY/Scripts/PlayerState/PlayerStateDead.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6fc619c4dc14ad98c56d083a62b56b7
|
||||
timeCreated: 1745481194
|
@ -11,8 +11,8 @@ public class PlayerStateIdle : IPlayerState
|
||||
|
||||
public void Update()
|
||||
{
|
||||
float inputHorizontal = _playerController.joystick.Horizontal;
|
||||
float inputVertical = _playerController.joystick.Vertical;
|
||||
float inputHorizontal = _playerController.Joystick.Horizontal;
|
||||
float inputVertical = _playerController.Joystick.Vertical;
|
||||
|
||||
// 이동
|
||||
if (inputHorizontal != 0 || inputVertical != 0)
|
||||
|
@ -14,8 +14,8 @@ public class PlayerStateMove : IPlayerState
|
||||
|
||||
public void Update()
|
||||
{
|
||||
float inputHorizontal = _playerController.joystick.Horizontal;
|
||||
float inputVertical = _playerController.joystick.Vertical;
|
||||
float inputHorizontal = _playerController.Joystick.Horizontal;
|
||||
float inputVertical = _playerController.Joystick.Vertical;
|
||||
|
||||
// 이동
|
||||
if (inputHorizontal != 0 || inputVertical != 0)
|
||||
@ -36,8 +36,8 @@ public class PlayerStateMove : IPlayerState
|
||||
|
||||
private void HandleMovement()
|
||||
{
|
||||
float inputHorizontal = _playerController.joystick.Horizontal;
|
||||
float inputVertical = _playerController.joystick.Vertical;
|
||||
float inputHorizontal = _playerController.Joystick.Horizontal;
|
||||
float inputVertical = _playerController.Joystick.Vertical;
|
||||
|
||||
Vector3 moveDir = new Vector3(inputHorizontal, 0, inputVertical);
|
||||
Vector3 move = moveDir.normalized * _playerController.moveSpeed;
|
||||
|
22
Assets/JAY/Scripts/PlayerState/PlayerStateWin.cs
Normal file
22
Assets/JAY/Scripts/PlayerState/PlayerStateWin.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerStateWin : IPlayerState
|
||||
{
|
||||
private PlayerController _playerController;
|
||||
|
||||
public void Enter(PlayerController playerController)
|
||||
{
|
||||
_playerController = playerController;
|
||||
_playerController.PlayerAnimator.SetBool("Win", true);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public void Exit()
|
||||
{
|
||||
_playerController.PlayerAnimator.SetBool("Win", false);
|
||||
_playerController = null;
|
||||
}
|
||||
}
|
3
Assets/JAY/Scripts/PlayerState/PlayerStateWin.cs.meta
Normal file
3
Assets/JAY/Scripts/PlayerState/PlayerStateWin.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e54b8d32431d4263a6a470f9a150b003
|
||||
timeCreated: 1745479273
|
@ -47,6 +47,11 @@ public class WeaponController : MonoBehaviour, IObservable<GameObject>
|
||||
}
|
||||
|
||||
_playerController = GetComponent<PlayerController>();
|
||||
if (_playerController == null)
|
||||
{
|
||||
_playerController = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
|
||||
}
|
||||
|
||||
_previousPositions = new Vector3[_triggerZones.Length];
|
||||
_hitColliders = new HashSet<Collider>();
|
||||
}
|
||||
@ -96,6 +101,17 @@ public class WeaponController : MonoBehaviour, IObservable<GameObject>
|
||||
if (!_hitColliders.Contains(hit.collider))
|
||||
{
|
||||
_hitColliders.Add(hit.collider);
|
||||
|
||||
Debug.Log("hit.collider.name: " + hit.collider.name);
|
||||
if (hit.collider.gameObject.CompareTag("Enemy"))
|
||||
{
|
||||
var enemyController = hit.transform.GetComponent<EnemyController>();
|
||||
if (enemyController != null)
|
||||
{
|
||||
enemyController.TakeDamage(AttackPower * _playerController.attackPower);
|
||||
}
|
||||
}
|
||||
|
||||
Notify(hit.collider.gameObject);
|
||||
}
|
||||
}
|
||||
|
BIN
Assets/JYY/Animator/PldDogControl.controller
(Stored with Git LFS)
BIN
Assets/JYY/Animator/PldDogControl.controller
(Stored with Git LFS)
Binary file not shown.
8
Assets/JYY/Models.meta
Normal file
8
Assets/JYY/Models.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ac3af37988877784e91ab90c4ade37d9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Models/Y Bot.fbx
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Models/Y Bot.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
109
Assets/JYY/Models/Y Bot.fbx.meta
Normal file
109
Assets/JYY/Models/Y Bot.fbx.meta
Normal file
@ -0,0 +1,109 @@
|
||||
fileFormatVersion: 2
|
||||
guid: decb96f75d6a2344baa18f902f21a131
|
||||
ModelImporter:
|
||||
serializedVersion: 22200
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
materials:
|
||||
materialImportMode: 2
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
materialLocation: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
removeConstantScaleCurves: 0
|
||||
motionNodeName:
|
||||
rigImportErrors:
|
||||
rigImportWarnings:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
importAnimatedCustomProperties: 0
|
||||
importConstraints: 0
|
||||
animationCompression: 3
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
extraUserProperties: []
|
||||
clipAnimations: []
|
||||
isReadable: 0
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
useSRGBMaterialColor: 1
|
||||
sortHierarchyByName: 1
|
||||
importPhysicalCameras: 1
|
||||
importVisibility: 1
|
||||
importBlendShapes: 1
|
||||
importCameras: 1
|
||||
importLights: 1
|
||||
nodeNameCollisionStrategy: 1
|
||||
fileIdsGeneration: 2
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
bakeAxisConversion: 0
|
||||
preserveHierarchy: 0
|
||||
skinWeightsMode: 0
|
||||
maxBonesPerVertex: 4
|
||||
minBoneWeight: 0.001
|
||||
optimizeBones: 1
|
||||
meshOptimizationFlags: -1
|
||||
indexFormat: 0
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVMarginMethod: 1
|
||||
secondaryUVMinLightmapResolution: 40
|
||||
secondaryUVMinObjectScale: 1
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
strictVertexDataChecks: 0
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
normalCalculationMode: 4
|
||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
||||
blendShapeNormalImportMode: 1
|
||||
normalSmoothingSource: 0
|
||||
referencedClips: []
|
||||
importAnimation: 1
|
||||
humanDescription:
|
||||
serializedVersion: 3
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
globalScale: 1
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
hasExtraRoot: 1
|
||||
skeletonHasParents: 1
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
autoGenerateAvatarMappingIfUnspecified: 1
|
||||
animationType: 3
|
||||
humanoidOversampling: 1
|
||||
avatarSetup: 1
|
||||
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
||||
importBlendShapeDeformPercent: 1
|
||||
remapMaterialsIfMaterialImportModeIsNone: 0
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/AOEIndicator.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/AOEIndicator.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Prefabs/AOEIndicatorChariot.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/AOEIndicatorChariot.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Prefabs/AOEIndicatorDynamo.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/AOEIndicatorDynamo.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Prefabs/AOEIndicatorHorizontal.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/AOEIndicatorHorizontal.prefab
(Stored with Git LFS)
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44d67bf59c049fb46876a549120a16d7
|
||||
guid: 0e60f1766f73dbc439ff69a154cc9a99
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
BIN
Assets/JYY/Prefabs/AOEIndicatorVertical.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/AOEIndicatorVertical.prefab
(Stored with Git LFS)
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9adff7c5e2e43974fa9f2d241ef2e433
|
||||
guid: dc0537feab3e2944aa554e23fb3923a3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
BIN
Assets/JYY/Prefabs/AoE Indicator Chariot.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/AoE Indicator Chariot.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Assets/JYY/Prefabs/AoE Indicator Horizontal.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/AoE Indicator Horizontal.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9e020ef2784edf4ca2a83ae9e1edefd
|
||||
guid: 44d67bf59c049fb46876a549120a16d7
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
BIN
Assets/JYY/Prefabs/AoE Indicator Vertical.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/AoE Indicator Vertical.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/AoE Indicator Vertical.prefab.meta
Normal file
7
Assets/JYY/Prefabs/AoE Indicator Vertical.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9adff7c5e2e43974fa9f2d241ef2e433
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/AoE Slash Blue Chariot.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/AoE Slash Blue Chariot.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/AoE Slash Blue Chariot.prefab.meta
Normal file
7
Assets/JYY/Prefabs/AoE Slash Blue Chariot.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f431e991bd65014c833e89305ddd5e3
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/Charge slash red.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/Charge slash red.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/Charge slash red.prefab.meta
Normal file
7
Assets/JYY/Prefabs/Charge slash red.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a0ddc8dd6d760e4e93999c4d49dc16c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/Explosion.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/Explosion.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/Explosion.prefab.meta
Normal file
7
Assets/JYY/Prefabs/Explosion.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ccd5acc2f6d74d4bb687fd2ee94b9de
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/Red energy explosion 1.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/Red energy explosion 1.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/Red energy explosion 1.prefab.meta
Normal file
7
Assets/JYY/Prefabs/Red energy explosion 1.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 49ada3fea2be23f4a988d4bc21dcaa32
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/Snow slash 1.prefab
(Stored with Git LFS)
Normal file
BIN
Assets/JYY/Prefabs/Snow slash 1.prefab
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/JYY/Prefabs/Snow slash 1.prefab.meta
Normal file
7
Assets/JYY/Prefabs/Snow slash 1.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03a874e2d684ee04a9729b8363fdbb9c
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/JYY/Prefabs/[Enemy] PldDog.prefab
(Stored with Git LFS)
BIN
Assets/JYY/Prefabs/[Enemy] PldDog.prefab
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/JYY/Scenes/MonsterTest.unity
(Stored with Git LFS)
BIN
Assets/JYY/Scenes/MonsterTest.unity
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/KJM/KJM.unity
(Stored with Git LFS)
BIN
Assets/KJM/KJM.unity
(Stored with Git LFS)
Binary file not shown.
8
Assets/KJM/KJM_Test/ISaveable.cs
Normal file
8
Assets/KJM/KJM_Test/ISaveable.cs
Normal file
@ -0,0 +1,8 @@
|
||||
/// <summary>
|
||||
/// 세이브 데이터를 주고 받는 함수 인터페이스
|
||||
/// </summary>
|
||||
public interface ISaveable
|
||||
{
|
||||
void ApplySaveData(Save save);
|
||||
Save ExtractSaveData();
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5765847dbef51e4f9bccde712eeda30
|
||||
guid: b8b6bcb2e37dea949b70a8a96f96e44b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -6,14 +6,27 @@ using UnityEngine;
|
||||
public class DungeonSave
|
||||
{
|
||||
// 강화 수치
|
||||
public int attackLevel;
|
||||
public int attackSpeedLevel;
|
||||
public int heartLevel;
|
||||
public int moveSpeedLevel;
|
||||
public int evasionTimeLevel;
|
||||
public int attackLevel = 0;
|
||||
public int attackSpeedLevel = 0;
|
||||
public int heartLevel = 0;
|
||||
public int moveSpeedLevel = 0;
|
||||
public int evasionTimeLevel = 0;
|
||||
|
||||
// 현재 진행 중인 스테이지
|
||||
public int stageLevel;
|
||||
public int stageLevel = 0;
|
||||
|
||||
//병합을 위한 메서드
|
||||
public void MergeWith(DungeonSave other)
|
||||
{
|
||||
if (other == null) return;
|
||||
|
||||
if (other.attackLevel != 0) attackLevel = other.attackLevel;
|
||||
if (other.attackSpeedLevel != 0) attackSpeedLevel = other.attackSpeedLevel;
|
||||
if (other.heartLevel != 0) heartLevel = other.heartLevel;
|
||||
if (other.moveSpeedLevel != 0) moveSpeedLevel = other.moveSpeedLevel;
|
||||
if (other.evasionTimeLevel != 0) evasionTimeLevel = other.evasionTimeLevel;
|
||||
if (other.stageLevel != 0) stageLevel = other.stageLevel;
|
||||
}
|
||||
}
|
||||
|
||||
// 일상(자취방) 관련 저장 데이터
|
||||
@ -21,17 +34,30 @@ public class DungeonSave
|
||||
public class HomeSave
|
||||
{
|
||||
// 일상 시간
|
||||
public float time;
|
||||
public int day;
|
||||
public int currentDay = 0;
|
||||
public float time = 999;
|
||||
|
||||
|
||||
// 체력 및 평판 수치
|
||||
public float health;
|
||||
public float reputation;
|
||||
public float health = 999;
|
||||
public float reputation = 999;
|
||||
|
||||
//이벤트
|
||||
public bool isEvent;
|
||||
public int mealCount;
|
||||
public int houseworkCount;
|
||||
public int mealCount = 999;
|
||||
public int houseworkCount = 999;
|
||||
|
||||
//병합을 위한 메서드
|
||||
public void MergeWith(HomeSave other)
|
||||
{
|
||||
if (other == null) return;
|
||||
|
||||
if (other.currentDay != 0) currentDay = other.currentDay;
|
||||
if (other.time < 999) time = other.time;
|
||||
if (other.health < 999) health = other.health;
|
||||
if (other.reputation < 999) reputation = other.reputation;
|
||||
if (other.mealCount < 999) mealCount = other.mealCount;
|
||||
if (other.houseworkCount < 999) houseworkCount = other.houseworkCount;
|
||||
}
|
||||
}
|
||||
|
||||
// 게임 전체 저장 구조
|
||||
|
82
Assets/KJM/KJM_Test/SaveDataController.cs
Normal file
82
Assets/KJM/KJM_Test/SaveDataController.cs
Normal file
@ -0,0 +1,82 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
public class SaveDataController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private MonoBehaviour[] saveableBehaviours;
|
||||
private ISaveable[] saveables;
|
||||
private Save tmpSave;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
tmpSave = new Save();
|
||||
|
||||
saveables = saveableBehaviours.OfType<ISaveable>().ToArray();
|
||||
|
||||
if (saveables == null || saveables.Length == 0)
|
||||
saveables = FindObjectsOfType<MonoBehaviour>().OfType<ISaveable>().ToArray();
|
||||
}
|
||||
|
||||
//세이브를 현재 상태에 적용
|
||||
public void ApplySaveData(Save saveData)
|
||||
{
|
||||
GetSaveDataFromManager(saveData);
|
||||
SendSaveDataToClass();
|
||||
}
|
||||
|
||||
//현재 상태를 세이브에 적용
|
||||
public Save GetSaveData()
|
||||
{
|
||||
UpdateSaveData();
|
||||
return tmpSave;
|
||||
}
|
||||
|
||||
//로컬에서 로드한 세이브 데이터를 받아오는 함수.
|
||||
private void GetSaveDataFromManager(Save saveData)
|
||||
{
|
||||
tmpSave = saveData;
|
||||
}
|
||||
|
||||
//세이브 데이터를 각클래스에게 적용하는 함수.
|
||||
private void SendSaveDataToClass()
|
||||
{
|
||||
foreach (var s in saveables)
|
||||
{
|
||||
s.ApplySaveData(tmpSave);
|
||||
}
|
||||
}
|
||||
|
||||
//각 클래스에게서 현재 정보를 받아오는 함수.
|
||||
private void UpdateSaveData()
|
||||
{
|
||||
foreach (var s in saveables)
|
||||
{
|
||||
Save partial = s.ExtractSaveData();
|
||||
MergeSave(ref tmpSave, partial);
|
||||
}
|
||||
}
|
||||
|
||||
private void MergeSave(ref Save baseSave, Save newSave)
|
||||
{
|
||||
if (newSave == null) return;
|
||||
|
||||
if (newSave.dungeonSave != null)
|
||||
{
|
||||
if (baseSave.dungeonSave == null)
|
||||
baseSave.dungeonSave = new DungeonSave();
|
||||
|
||||
baseSave.dungeonSave.MergeWith(newSave.dungeonSave);
|
||||
}
|
||||
|
||||
if (newSave.homeSave != null)
|
||||
{
|
||||
if (baseSave.homeSave == null)
|
||||
baseSave.homeSave = new HomeSave();
|
||||
|
||||
baseSave.homeSave.MergeWith(newSave.homeSave);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/KJM/KJM_Test/SaveDataController.cs.meta
Normal file
11
Assets/KJM/KJM_Test/SaveDataController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e5de90e465e1ed4f91e2e6f11e17273
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -13,6 +13,7 @@ public class SaveManager : Singleton<SaveManager>
|
||||
private string MainSaveFilePath => GetSavePath("Save_Main");
|
||||
private string BackupSaveFilePath => GetSavePath("Save_Backup");
|
||||
|
||||
[SerializeField] private SaveDataController saveDataController;
|
||||
|
||||
private Save mainSave;
|
||||
private Save backupSave;
|
||||
@ -25,7 +26,7 @@ public class SaveManager : Singleton<SaveManager>
|
||||
|
||||
public void Save()
|
||||
{
|
||||
if(JsonUtility.ToJson(mainSave) == JsonUtility.ToJson(StatManager.instance.ToSaveData())) //같은 상태는 저장되지 않음. 백업 덮어쓰기 방지.
|
||||
if(JsonUtility.ToJson(mainSave) == JsonUtility.ToJson(saveDataController.GetSaveData())) //같은 상태는 저장되지 않음. 백업 덮어쓰기 방지.
|
||||
return;
|
||||
|
||||
EnsureSaveExists();
|
||||
@ -45,7 +46,7 @@ public class SaveManager : Singleton<SaveManager>
|
||||
mainSave = LoadMain();
|
||||
backupSave = LoadBackup();
|
||||
|
||||
StatManager.instance.loadSaveData2StataManager(mainSave);
|
||||
saveDataController.ApplySaveData(mainSave);
|
||||
|
||||
Debug.Log("메인 로드" + mainSave.homeSave.reputation); //임시 코드
|
||||
Debug.Log("백업 로드" + backupSave.homeSave.reputation); //임시 코드
|
||||
@ -53,7 +54,7 @@ public class SaveManager : Singleton<SaveManager>
|
||||
|
||||
private void UpdateSaveInfo()
|
||||
{
|
||||
mainSave = StatManager.instance.ToSaveData(); //스탯을 관리하는 클래스에 선언된 스탯 업데이트 함수를 호출
|
||||
mainSave = saveDataController.GetSaveData(); //스탯을 관리하는 클래스에 선언된 스탯 업데이트 함수를 호출
|
||||
}
|
||||
|
||||
private void SaveMain()
|
||||
@ -119,7 +120,7 @@ public class SaveManager : Singleton<SaveManager>
|
||||
//더미 세이브 파일 생성
|
||||
private Save CreateNewSave()
|
||||
{
|
||||
var fresh = StatManager.instance.ToSaveData();
|
||||
var fresh = saveDataController.GetSaveData();
|
||||
SaveMain();
|
||||
SaveBackup();
|
||||
return fresh;
|
||||
|
@ -1,120 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
/// <summary>
|
||||
/// 테스트용 임시 클래스
|
||||
/// </summary>
|
||||
public class StatManager : MonoBehaviour
|
||||
{
|
||||
public static StatManager instance;
|
||||
|
||||
public int attackLevel;
|
||||
public int attackSpeedLevel;
|
||||
public int heartLevel;
|
||||
public int moveSpeedLevel;
|
||||
public int evasionTimeLevel;
|
||||
public int stageLevel;
|
||||
|
||||
public float time;
|
||||
public int day;
|
||||
public float health;
|
||||
public float reputation;
|
||||
|
||||
public bool isEvent; //Todo 이벤트 여부 및 관련 조건들 추가
|
||||
public int mealCount;
|
||||
public int houseworkCount;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스탯값 변화
|
||||
/// </summary>
|
||||
public void ChangeValue()
|
||||
{
|
||||
float floatValue = Random.Range(0f, 2f);
|
||||
Debug.Log(floatValue);
|
||||
int intValue = Random.Range(0, 10);
|
||||
Debug.Log(intValue);
|
||||
|
||||
attackLevel = intValue;
|
||||
attackSpeedLevel = intValue;
|
||||
heartLevel = intValue;
|
||||
moveSpeedLevel = intValue;
|
||||
evasionTimeLevel = intValue;
|
||||
stageLevel = intValue;
|
||||
|
||||
|
||||
time = floatValue;
|
||||
day = intValue;
|
||||
health = floatValue;
|
||||
reputation = floatValue;
|
||||
|
||||
isEvent = false;
|
||||
mealCount = intValue;
|
||||
houseworkCount = intValue;
|
||||
|
||||
Debug.Log("ChangeValue");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 스탯값 반환
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Save ToSaveData()
|
||||
{
|
||||
return new Save
|
||||
{
|
||||
dungeonSave = new DungeonSave
|
||||
{
|
||||
attackLevel = this.attackLevel,
|
||||
attackSpeedLevel = this.attackSpeedLevel,
|
||||
heartLevel = this.heartLevel,
|
||||
moveSpeedLevel = this.moveSpeedLevel,
|
||||
evasionTimeLevel = this.evasionTimeLevel,
|
||||
stageLevel = this.stageLevel
|
||||
},
|
||||
homeSave = new HomeSave
|
||||
{
|
||||
time = this.time,
|
||||
day = this.day,
|
||||
health = this.health,
|
||||
reputation = this.reputation,
|
||||
isEvent = false,
|
||||
mealCount = this.mealCount,
|
||||
houseworkCount = this.houseworkCount,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void loadSaveData2StataManager(Save saveData)
|
||||
{
|
||||
attackLevel = saveData.dungeonSave.attackLevel;
|
||||
attackSpeedLevel = saveData.dungeonSave.attackSpeedLevel;
|
||||
heartLevel = saveData.dungeonSave.heartLevel;
|
||||
moveSpeedLevel = saveData.dungeonSave.moveSpeedLevel;
|
||||
evasionTimeLevel = saveData.dungeonSave.evasionTimeLevel;
|
||||
stageLevel = saveData.dungeonSave.stageLevel;
|
||||
|
||||
time = saveData.homeSave.time;
|
||||
day = saveData.homeSave.day;
|
||||
health = saveData.homeSave.health;
|
||||
reputation = saveData.homeSave.reputation;
|
||||
isEvent = saveData.homeSave.isEvent;
|
||||
mealCount = saveData.homeSave.mealCount;
|
||||
houseworkCount = saveData.homeSave.houseworkCount;
|
||||
}
|
||||
|
||||
public void SceneChange()
|
||||
{
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
}
|
122
Assets/KJM/KJM_Test/TestScript.cs
Normal file
122
Assets/KJM/KJM_Test/TestScript.cs
Normal file
@ -0,0 +1,122 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
/// <summary>
|
||||
/// 테스트용 임시 클래스
|
||||
/// </summary>
|
||||
public class TestScript : MonoBehaviour,ISaveable
|
||||
{
|
||||
//던전
|
||||
private int attackLevel;
|
||||
private int attackSpeedLevel;
|
||||
private int heartLevel;
|
||||
private int moveSpeedLevel;
|
||||
private int evasionTimeLevel;
|
||||
private int stageLevel;
|
||||
|
||||
//일상
|
||||
private float time;
|
||||
private int currentDay;
|
||||
private float health;
|
||||
private float reputation;
|
||||
private int mealCount;
|
||||
private int houseworkCount;
|
||||
|
||||
/// <summary>
|
||||
/// 스탯값 랜덤 변화
|
||||
/// </summary>
|
||||
public void ChangeValue()
|
||||
{
|
||||
float floatValue = Random.Range(0f, 2f);
|
||||
int intValue = Random.Range(0, 10);
|
||||
|
||||
attackLevel = intValue;
|
||||
attackSpeedLevel = intValue;
|
||||
heartLevel = intValue;
|
||||
moveSpeedLevel = intValue;
|
||||
stageLevel = intValue;
|
||||
|
||||
|
||||
time = floatValue;
|
||||
currentDay = intValue;
|
||||
health = floatValue;
|
||||
reputation = floatValue;
|
||||
mealCount = intValue;
|
||||
houseworkCount = intValue;
|
||||
|
||||
Debug.Log("ChangeValue : " + floatValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 인터페이스 함수1, 데이터 불러오기
|
||||
/// </summary>
|
||||
/// <param name="save"></param>
|
||||
public void ApplySaveData(Save save)
|
||||
{
|
||||
if (save?.dungeonSave != null)
|
||||
{
|
||||
attackLevel = save.dungeonSave.attackLevel;
|
||||
attackSpeedLevel = save.dungeonSave.attackSpeedLevel;
|
||||
heartLevel = save.dungeonSave.heartLevel;
|
||||
moveSpeedLevel = save.dungeonSave.moveSpeedLevel;
|
||||
evasionTimeLevel = save.dungeonSave.evasionTimeLevel;
|
||||
stageLevel = save.dungeonSave.stageLevel;
|
||||
}
|
||||
|
||||
if (save?.homeSave != null)
|
||||
{
|
||||
time = save.homeSave.time;
|
||||
currentDay = save.homeSave.currentDay;
|
||||
health = save.homeSave.health;
|
||||
reputation = save.homeSave.reputation;
|
||||
mealCount = save.homeSave.mealCount;
|
||||
houseworkCount = save.homeSave.houseworkCount;
|
||||
|
||||
Debug.Log("ApplySaveData : " + reputation);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 인터페이스 함수2, 데이터 전달
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Save ExtractSaveData()
|
||||
{
|
||||
return new Save
|
||||
{
|
||||
dungeonSave = new DungeonSave()
|
||||
{
|
||||
attackLevel = this.attackLevel,
|
||||
attackSpeedLevel = this.attackSpeedLevel,
|
||||
heartLevel = this.heartLevel,
|
||||
moveSpeedLevel = this.moveSpeedLevel,
|
||||
evasionTimeLevel = this.evasionTimeLevel,
|
||||
stageLevel = this.stageLevel,
|
||||
|
||||
},
|
||||
|
||||
homeSave = new HomeSave
|
||||
{
|
||||
time = this.time,
|
||||
currentDay = this.currentDay,
|
||||
health = this.health,
|
||||
reputation = this.reputation,
|
||||
mealCount = this.mealCount,
|
||||
houseworkCount = this.houseworkCount
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 씬 전환 테스트용 함수
|
||||
/// </summary>
|
||||
public void SceneChange()
|
||||
{
|
||||
SceneManager.LoadScene("Main");
|
||||
}
|
||||
|
||||
}
|
105
Assets/KSH/DungeonLogic.cs
Normal file
105
Assets/KSH/DungeonLogic.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DungeonLogic : MonoBehaviour
|
||||
{
|
||||
[NonSerialized] public bool isCompleted = false; // 던전 클리어 여부
|
||||
[NonSerialized] public bool isFailed = false; // 던전 실패 여부
|
||||
|
||||
private PlayerController _player;
|
||||
private EnemyController _enemy;
|
||||
|
||||
// 던전 결과 이벤트
|
||||
public event Action OnDungeonSuccess;
|
||||
public event Action OnDungeonFailure;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
// tag를 통해 할당 / 추후 플레이어와 에너미 태그 추가 필요
|
||||
_player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>();
|
||||
_enemy = GameObject.FindGameObjectWithTag("Enemy").GetComponent<EnemyController>();
|
||||
|
||||
// 죽음 이벤트 구독
|
||||
if (_player != null)
|
||||
{
|
||||
_player.OnDeath += OnPlayerDeath;
|
||||
}
|
||||
|
||||
if (_enemy != null)
|
||||
{
|
||||
_enemy.OnDeath += OnEnemyDeath;
|
||||
}
|
||||
}
|
||||
|
||||
// 플레이어 사망 처리
|
||||
private void OnPlayerDeath(CharacterBase player)
|
||||
{
|
||||
Debug.Log("player name:" + player.characterName);
|
||||
if (!isFailed) // 중복 실행 방지
|
||||
{
|
||||
FailDungeon();
|
||||
}
|
||||
}
|
||||
|
||||
// 적 사망 처리
|
||||
private void OnEnemyDeath(CharacterBase enemy)
|
||||
{
|
||||
Debug.Log("enemy name:" + enemy.characterName);
|
||||
if (!isCompleted) // 중복 실행 방지
|
||||
{
|
||||
CompleteDungeon();
|
||||
}
|
||||
}
|
||||
|
||||
// 던전 성공 처리
|
||||
public void CompleteDungeon()
|
||||
{
|
||||
if (!isCompleted && !isFailed)
|
||||
{
|
||||
Debug.Log("던전 공략 성공~!");
|
||||
isCompleted = true;
|
||||
OnDungeonSuccess?.Invoke();
|
||||
|
||||
// 성공 UI 표시 ?? 강화 표기
|
||||
// TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동
|
||||
}
|
||||
}
|
||||
|
||||
// 던전 실패 처리
|
||||
public void FailDungeon()
|
||||
{
|
||||
if (!isCompleted && !isFailed)
|
||||
{
|
||||
Debug.Log("던전 공략 실패~!");
|
||||
isFailed = true;
|
||||
OnDungeonFailure?.Invoke();
|
||||
|
||||
// 죽음 애니메이션 + 실패 UI 표시 ?
|
||||
// GameManager.Instance.ChangeToHomeScene();
|
||||
|
||||
StartCoroutine(DelayedSceneChange()); // 테스트를 위해 3초 대기 후 전환
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator DelayedSceneChange()
|
||||
{
|
||||
yield return new WaitForSeconds(3f);
|
||||
GameManager.Instance.ChangeToHomeScene();
|
||||
}
|
||||
|
||||
// 게임 오브젝트 제거 시 이벤트 구독 해제
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (_player != null)
|
||||
{
|
||||
_player.OnDeath -= OnPlayerDeath;
|
||||
}
|
||||
|
||||
if (_enemy != null)
|
||||
{
|
||||
_enemy.OnDeath -= OnEnemyDeath;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/KSH/DungeonLogic.cs.meta
Normal file
11
Assets/KSH/DungeonLogic.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ecf4896d6eb9a514e8f83175d8a33a22
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/KSH/DungeonTestScene.unity
(Stored with Git LFS)
Normal file
BIN
Assets/KSH/DungeonTestScene.unity
(Stored with Git LFS)
Normal file
Binary file not shown.
7
Assets/KSH/DungeonTestScene.unity.meta
Normal file
7
Assets/KSH/DungeonTestScene.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4563b107911b0e54cbdf659694a6f17a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -13,6 +13,13 @@ public class InteractionController : MonoBehaviour
|
||||
[Header("UI 연동")]
|
||||
[SerializeField] HousingCanvasController housingCanvasController;
|
||||
|
||||
private SuddenEventController _suddenEventController = new SuddenEventController();
|
||||
|
||||
private void Start()
|
||||
{
|
||||
playerStats.OnWorked += SuddenAfterWorkEventHappen;
|
||||
}
|
||||
|
||||
// 상호작용 가능한 사물 범위에 들어올 때
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
@ -37,64 +44,47 @@ public class InteractionController : MonoBehaviour
|
||||
// ActionType 별로 화면에 상호작용 내용 표시, 상호작용 버튼에 이벤트 작성
|
||||
private void PopActionOnScreen(ActionType interactionType)
|
||||
{
|
||||
switch (interactionType)
|
||||
HousingConstants.interactions.TryGetValue(interactionType, out var interactionTexts);
|
||||
|
||||
housingCanvasController.ShowInteractionButton(interactionTexts.ActionText,interactionTexts.DescriptionText,()=>
|
||||
{
|
||||
case ActionType.Sleep:
|
||||
housingCanvasController.ShowInteractionButton("침대에서 잘까?","숙면으로 시간 당 체력 1을 회복한다.", () =>
|
||||
if (playerStats.CanPerformByHealth(interactionType))
|
||||
{
|
||||
playerStats.PerformAction(ActionType.Sleep);
|
||||
housingCanvasController.HideInteractionButton();
|
||||
//TODO: 화면 전환 효과와 UI 업데이트 작업
|
||||
});
|
||||
break;
|
||||
case ActionType.Housework:
|
||||
housingCanvasController.ShowInteractionButton("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다", () =>
|
||||
{
|
||||
if (playerStats.CanPerformByHealth(ActionType.Housework))
|
||||
{
|
||||
playerStats.PerformAction(ActionType.Housework);
|
||||
housingCanvasController.HideInteractionButton();
|
||||
//TODO: 집안일 후 랜덤 강화 효과 적용
|
||||
playerStats.PerformAction(interactionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
housingCanvasController.SetActionText("힘들어서 못해..");
|
||||
housingCanvasController.SetActionText(interactionTexts.LackOfHealth);
|
||||
housingCanvasController.SetDescriptionText();
|
||||
}
|
||||
});
|
||||
break;
|
||||
case ActionType.Dungeon:
|
||||
housingCanvasController.ShowInteractionButton("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.", () =>
|
||||
{
|
||||
if (playerStats.CanPerformByHealth(ActionType.Dungeon))
|
||||
{
|
||||
playerStats.PerformAction(ActionType.Dungeon);
|
||||
housingCanvasController.HideInteractionButton();
|
||||
}
|
||||
else
|
||||
|
||||
public Action SuddenEventHappen()
|
||||
{
|
||||
housingCanvasController.SetActionText("던전에 갈 체력이 되지 않아..");
|
||||
housingCanvasController.SetDescriptionText();
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SuddenAfterWorkEventHappen()
|
||||
{
|
||||
AfterWorkEvent afterWorkEvent = _suddenEventController.SuddenEventCalculator();
|
||||
if (afterWorkEvent == AfterWorkEvent.None)
|
||||
return;
|
||||
switch (afterWorkEvent)
|
||||
{
|
||||
case AfterWorkEvent.OvertimeWork:
|
||||
housingCanvasController.ShowSuddenEventPanel("부장님이 퇴근을 안하셔.. 야근할까?", () =>
|
||||
{
|
||||
//Todo: 컷씬과 스테이터스 변경
|
||||
housingCanvasController.HideSuddenEventPanel();
|
||||
});
|
||||
break;
|
||||
case ActionType.Work:
|
||||
housingCanvasController.ShowInteractionButton("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", () =>
|
||||
case AfterWorkEvent.TeamGathering:
|
||||
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", () =>
|
||||
{
|
||||
if (playerStats.CanPerformByHealth(ActionType.Work))
|
||||
{
|
||||
playerStats.PerformAction(ActionType.Work);
|
||||
housingCanvasController.HideInteractionButton();
|
||||
}
|
||||
else
|
||||
{
|
||||
housingCanvasController.SetActionText("도저히 출근할 체력이 안되는걸..?");
|
||||
housingCanvasController.SetDescriptionText();
|
||||
}
|
||||
housingCanvasController.HideSuddenEventPanel();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
BIN
Assets/LIN/Housing Copy.unity
(Stored with Git LFS)
Binary file not shown.
@ -6,19 +6,26 @@ using UnityEngine;
|
||||
|
||||
public class HousingCanvasController : MonoBehaviour
|
||||
{
|
||||
[Header("일상행동 상호작용")]
|
||||
[SerializeField] GameObject interactionButton;
|
||||
[SerializeField] TMP_Text actionText;
|
||||
[SerializeField] TMP_Text descriptionText;
|
||||
|
||||
public Action OnInteractionButtonPressed;
|
||||
[Header("돌발 이벤트")]
|
||||
[SerializeField] private GameObject suddenPanel;
|
||||
[SerializeField] private TMP_Text suddenText;
|
||||
|
||||
public Action OnInteractionButtonPressed;
|
||||
public Action OnSuddenButtonPressed;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
InitTexts();
|
||||
InitInteractionTexts();
|
||||
interactionButton.SetActive(false);
|
||||
suddenPanel.SetActive(false);
|
||||
}
|
||||
|
||||
#region 상호작용 일상 행동
|
||||
//사물 이름 세팅
|
||||
public void SetActionText(string text = "")
|
||||
{
|
||||
@ -30,7 +37,7 @@ public class HousingCanvasController : MonoBehaviour
|
||||
descriptionText.text = text;
|
||||
}
|
||||
|
||||
private void InitTexts()
|
||||
private void InitInteractionTexts()
|
||||
{
|
||||
SetActionText();
|
||||
SetDescriptionText();
|
||||
@ -46,7 +53,6 @@ public class HousingCanvasController : MonoBehaviour
|
||||
//각 행동 별로 실행되어야 할 이벤트 구독
|
||||
OnInteractionButtonPressed = onInteractionButtonPressed;
|
||||
}
|
||||
|
||||
//범위에서 벗어나면 상호작용 버튼 off
|
||||
public void HideInteractionButton()
|
||||
{
|
||||
@ -62,5 +68,27 @@ public class HousingCanvasController : MonoBehaviour
|
||||
public void OnClickInteractionButton()
|
||||
{
|
||||
OnInteractionButtonPressed?.Invoke();
|
||||
HideInteractionButton();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 돌발 이벤트
|
||||
public void ShowSuddenEventPanel(string actText, Action onSuddenButtonPressed)
|
||||
{
|
||||
suddenPanel.SetActive(true);
|
||||
suddenText.text = actText;
|
||||
OnSuddenButtonPressed += onSuddenButtonPressed;
|
||||
}
|
||||
public void HideSuddenEventPanel()
|
||||
{
|
||||
suddenPanel.SetActive(false);
|
||||
suddenText.text = "";
|
||||
OnSuddenButtonPressed = null;
|
||||
}
|
||||
public void OnSuddenConfirmButton()
|
||||
{
|
||||
OnSuddenButtonPressed?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
43
Assets/LIN/HousingConstants.cs
Normal file
43
Assets/LIN/HousingConstants.cs
Normal file
@ -0,0 +1,43 @@
|
||||
//퇴근 후 발생할 수 있는 돌발 이벤트
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public enum AfterWorkEvent
|
||||
{
|
||||
None,
|
||||
TeamGathering,
|
||||
OvertimeWork
|
||||
}
|
||||
|
||||
public static class HousingConstants
|
||||
{
|
||||
//돌발 이벤트 확률 계산
|
||||
public static int AFTER_WORK_DENOMINATOR = 4;
|
||||
|
||||
|
||||
#region 상호작용 멘트
|
||||
|
||||
public static readonly Dictionary<ActionType, InteractionTexts> interactions =
|
||||
new Dictionary<ActionType, InteractionTexts>
|
||||
{
|
||||
{ ActionType.Sleep, new InteractionTexts("침대에서 잘까?","숙면으로 시간 당 체력 1을 회복한다.", ".")},
|
||||
{ ActionType.Housework, new InteractionTexts("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다","힘들어서 못해..")},
|
||||
{ ActionType.Dungeon, new InteractionTexts("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.","던전에 갈 체력이 되지 않아..")},
|
||||
{ ActionType.Work, new InteractionTexts("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", "도저히 출근할 체력이 안되는걸..?")}
|
||||
};
|
||||
#endregion
|
||||
|
||||
public struct InteractionTexts
|
||||
{
|
||||
public string ActionText { get; private set; }
|
||||
public string DescriptionText { get; private set; }
|
||||
public string LackOfHealth { get; private set; }
|
||||
|
||||
public InteractionTexts(string actionText, string descriptionText, string lackOfHealth)
|
||||
{
|
||||
ActionText = actionText;
|
||||
DescriptionText = descriptionText;
|
||||
LackOfHealth = lackOfHealth;
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/LIN/HousingConstants.cs.meta
Normal file
3
Assets/LIN/HousingConstants.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0ce52df52334b1eaf37479fdda66f7a
|
||||
timeCreated: 1745303266
|
24
Assets/LIN/SuddenEventController.cs
Normal file
24
Assets/LIN/SuddenEventController.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
public class SuddenEventController
|
||||
{
|
||||
// 랜덤 값에 일치하는 함수를 리턴하기 위한 딕셔너리
|
||||
// AFTER_WORK_DENOMINATOR 값 확정 후에 키 값 수정
|
||||
private Dictionary<int, AfterWorkEvent> afterWorkEvents = new Dictionary<int, AfterWorkEvent>();
|
||||
public SuddenEventController()
|
||||
{
|
||||
afterWorkEvents.Add(0, AfterWorkEvent.OvertimeWork);
|
||||
afterWorkEvents.Add(1, AfterWorkEvent.TeamGathering);
|
||||
}
|
||||
|
||||
//퇴근 후 돌발 이벤트
|
||||
public AfterWorkEvent SuddenEventCalculator()
|
||||
{
|
||||
var index = Random.Range(0,HousingConstants.AFTER_WORK_DENOMINATOR);
|
||||
return afterWorkEvents.GetValueOrDefault(index, AfterWorkEvent.None);
|
||||
}
|
||||
|
||||
}
|
3
Assets/LIN/SuddenEventController.cs.meta
Normal file
3
Assets/LIN/SuddenEventController.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26ce8577425c4630903173b182839514
|
||||
timeCreated: 1745306651
|
BIN
Assets/Resources/Player/Weapon/Chopstick.prefab
(Stored with Git LFS)
BIN
Assets/Resources/Player/Weapon/Chopstick.prefab
(Stored with Git LFS)
Binary file not shown.
8
Assets/Scenes/Housing.meta
Normal file
8
Assets/Scenes/Housing.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57342d13612d4a240981df8a13a16c12
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:56c7c829ffd91cd42fa0653c05b5e81708b30f5b364c2fc5570f4a0c3fb810d2
|
||||
size 100544
|
||||
oid sha256:208ecb0c73a3316229232d356a4ae82d1a70e3418e187edc7073d67c6b27699c
|
||||
size 253
|
||||
|
BIN
Assets/Scenes/Housing/LightingData.asset
Normal file
BIN
Assets/Scenes/Housing/LightingData.asset
Normal file
Binary file not shown.
8
Assets/Scenes/Housing/LightingData.asset.meta
Normal file
8
Assets/Scenes/Housing/LightingData.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10550dbcfa71e3e4cb0e91a0bb7a19f0
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 112000000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Scenes/Housing/Lightmap-0_comp_dir.png
(Stored with Git LFS)
Normal file
BIN
Assets/Scenes/Housing/Lightmap-0_comp_dir.png
(Stored with Git LFS)
Normal file
Binary file not shown.
127
Assets/Scenes/Housing/Lightmap-0_comp_dir.png.meta
Normal file
127
Assets/Scenes/Housing/Lightmap-0_comp_dir.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e30dc677714519945b30e7215332fd38
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 1
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 3
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 12
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Scenes/Housing/Lightmap-0_comp_light.exr
Normal file
BIN
Assets/Scenes/Housing/Lightmap-0_comp_light.exr
Normal file
Binary file not shown.
127
Assets/Scenes/Housing/Lightmap-0_comp_light.exr.meta
Normal file
127
Assets/Scenes/Housing/Lightmap-0_comp_light.exr.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ff23c25ba734b9468d6f3bb8a24be15
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 1
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 3
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 6
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Scenes/Housing/Lightmap-0_comp_shadowmask.png
(Stored with Git LFS)
Normal file
BIN
Assets/Scenes/Housing/Lightmap-0_comp_shadowmask.png
(Stored with Git LFS)
Normal file
Binary file not shown.
127
Assets/Scenes/Housing/Lightmap-0_comp_shadowmask.png.meta
Normal file
127
Assets/Scenes/Housing/Lightmap-0_comp_shadowmask.png.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66363697428821b4eaa87bdcb2da8ff1
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 1
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 3
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 0
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 11
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Scenes/Housing/ReflectionProbe-0.exr
Normal file
BIN
Assets/Scenes/Housing/ReflectionProbe-0.exr
Normal file
Binary file not shown.
127
Assets/Scenes/Housing/ReflectionProbe-0.exr.meta
Normal file
127
Assets/Scenes/Housing/ReflectionProbe-0.exr.meta
Normal file
@ -0,0 +1,127 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 643882fa4c2925347bd364c2285322af
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 1
|
||||
seamlessCubemap: 1
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 2
|
||||
aniso: 0
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 0
|
||||
textureShape: 2
|
||||
singleChannelComponent: 0
|
||||
flipbookRows: 1
|
||||
flipbookColumns: 1
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
ignorePngGamma: 0
|
||||
applyGammaDecoding: 0
|
||||
swizzle: 50462976
|
||||
cookieLightType: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 100
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
ignorePlatformSupport: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
nameFileIdTable: {}
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -17,6 +17,8 @@ public abstract class CharacterBase : MonoBehaviour
|
||||
[Header("상태 이상")]
|
||||
public List<StatusEffect> statusEffects = new List<StatusEffect>();
|
||||
|
||||
public event System.Action<CharacterBase> OnDeath; // 사망 이벤트
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
currentHP = maxHP;
|
||||
@ -38,6 +40,7 @@ public abstract class CharacterBase : MonoBehaviour
|
||||
{
|
||||
Debug.Log($"{characterName}이 사망했습니다.");
|
||||
// TODO: 사망 처리
|
||||
OnDeath?.Invoke(this);
|
||||
}
|
||||
|
||||
// 상태이상 추가 메서드
|
||||
|
3
Assets/Scripts/Character/Enemy/BossPattern.meta
Normal file
3
Assets/Scripts/Character/Enemy/BossPattern.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3b800a343fe42afa7494329ef235461
|
||||
timeCreated: 1745300808
|
115
Assets/Scripts/Character/Enemy/BossPattern/AoeControllerBase.cs
Normal file
115
Assets/Scripts/Character/Enemy/BossPattern/AoeControllerBase.cs
Normal file
@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
[Serializable]
|
||||
public struct DamageEffectData
|
||||
{
|
||||
public int damage;
|
||||
public float radius;
|
||||
public float delay;
|
||||
public LayerMask targetLayer;
|
||||
public GameObject explosionEffectPrefab;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AOE 범위 공격의 공통 로직을 처리하는 추상 베이스 클래스입니다.
|
||||
/// </summary>
|
||||
public abstract class AoeControllerBase : MonoBehaviour
|
||||
{
|
||||
[Header("경고 이펙트")]
|
||||
[SerializeField] protected GameObject warningEffectInstance;
|
||||
|
||||
protected DamageEffectData _data;
|
||||
private Action _slashAction;
|
||||
private Action _destroyAction;
|
||||
|
||||
/// <summary>
|
||||
/// 범위 공격 이펙트를 설정하고, 딜레이 후 폭발을 실행합니다.
|
||||
/// </summary>
|
||||
public void SetEffect(DamageEffectData data, Action slashAction, Action destroyAction)
|
||||
{
|
||||
_data = data;
|
||||
_slashAction = slashAction;
|
||||
_destroyAction = destroyAction;
|
||||
|
||||
ShowWarningEffect();
|
||||
StartCoroutine(ExplodeAfterDelay());
|
||||
}
|
||||
|
||||
protected virtual void ShowWarningEffect()
|
||||
{
|
||||
if (warningEffectInstance != null)
|
||||
warningEffectInstance.SetActive(true);
|
||||
|
||||
float diameter = _data.radius * 2f;
|
||||
transform.localScale = new Vector3(diameter, 1f, diameter);
|
||||
}
|
||||
|
||||
private IEnumerator ExplodeAfterDelay()
|
||||
{
|
||||
yield return new WaitForSeconds(_data.delay);
|
||||
Explode();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 폭발 이펙트 생성, 데미지 처리, 콜백 호출 순서로 실행합니다.
|
||||
/// </summary>
|
||||
protected virtual void Explode()
|
||||
{
|
||||
// 경고 이펙트 숨기기
|
||||
if (warningEffectInstance != null)
|
||||
warningEffectInstance.SetActive(false);
|
||||
|
||||
ShowDamageEffect();
|
||||
|
||||
// 슬래시 액션(애니메이션 트리거) 호출
|
||||
_slashAction?.Invoke();
|
||||
|
||||
// 범위 내 데미지 처리
|
||||
HitCheck();
|
||||
|
||||
// 패턴 클리어 콜백
|
||||
_destroyAction?.Invoke();
|
||||
|
||||
// 자기 자신 제거
|
||||
Destroy(gameObject, 2f);
|
||||
}
|
||||
|
||||
protected virtual void HitCheck()
|
||||
{
|
||||
var hits = Physics.OverlapSphere(transform.position, _data.radius, _data.targetLayer);
|
||||
foreach (var hit in hits)
|
||||
{
|
||||
if (hit.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log($"{hit.name}에게 {_data.damage} 데미지 적용");
|
||||
// TODO: 실제 데미지 처리 로직 호출
|
||||
// 임시 데이미 처리 로직
|
||||
PlayerController playerController = hit.transform.GetComponent<PlayerController>();
|
||||
if (playerController != null)
|
||||
{
|
||||
playerController.TakeDamage(_data.damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ShowDamageEffect()
|
||||
{
|
||||
// 폭발 이펙트 생성
|
||||
if (_data.explosionEffectPrefab != null)
|
||||
{
|
||||
var effect = Instantiate(_data.explosionEffectPrefab, transform.position, transform.rotation);
|
||||
effect.transform.localScale = new Vector3(_data.radius, _data.radius, _data.radius);
|
||||
Destroy(effect, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawWireSphere(transform.position, _data.radius);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1dd40dca214a4038be21f64ce645e5d9
|
||||
timeCreated: 1745393630
|
@ -0,0 +1,4 @@
|
||||
public class BoomAoeController : AoeControllerBase
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e32c2002701d49df83faa36b3da55436
|
||||
timeCreated: 1745395178
|
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
|
||||
public class ChariotAoeController : AoeControllerBase
|
||||
{
|
||||
protected override void ShowDamageEffect()
|
||||
{
|
||||
// 폭발 이펙트 생성
|
||||
if (_data.explosionEffectPrefab != null)
|
||||
{
|
||||
var effect = Instantiate(_data.explosionEffectPrefab, transform.position, transform.rotation);
|
||||
effect.transform.localScale = new Vector3(2f, 2f, 2f);
|
||||
Destroy(effect, 2f);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class HorizontalAoeController : AoeControllerBase
|
||||
{
|
||||
private float slashAngle = 270f;
|
||||
private int gizmoSegments = 20;
|
||||
protected override void HitCheck()
|
||||
{
|
||||
var hits = Physics.OverlapSphere(transform.position, _data.radius, _data.targetLayer);
|
||||
foreach (var hit in hits)
|
||||
{
|
||||
if (!hit.CompareTag("Player")) continue;
|
||||
|
||||
Vector3 dir = hit.transform.position - transform.position;
|
||||
dir.y = 0;
|
||||
float angleToForward = Vector3.Angle(transform.forward, dir);
|
||||
|
||||
if (angleToForward <= slashAngle * 0.5f)
|
||||
{
|
||||
Debug.Log($"{hit.name}이(가) 횡적 슬래시 데미지 범위에 있습니다.");
|
||||
Debug.Log($"{hit.name}에게 {_data.damage} 데미지 적용");
|
||||
// TODO: 실제 데미지 처리 로직 호출
|
||||
// 임시 데이미 처리 로직
|
||||
PlayerController playerController = hit.transform.GetComponent<PlayerController>();
|
||||
if (playerController != null)
|
||||
{
|
||||
playerController.TakeDamage(_data.damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
// 부채꼴 형태 기즈모 드로잉
|
||||
Gizmos.color = Color.red;
|
||||
Vector3 origin = transform.position;
|
||||
float halfAngle = slashAngle * 0.5f;
|
||||
float step = slashAngle / gizmoSegments;
|
||||
|
||||
// 시작 포인트
|
||||
Vector3 prevDir = Quaternion.AngleAxis(-halfAngle, Vector3.up) * transform.forward;
|
||||
Vector3 prevPoint = origin + prevDir.normalized * _data.radius;
|
||||
Gizmos.DrawLine(origin, prevPoint);
|
||||
|
||||
for (int i = 1; i <= gizmoSegments; i++)
|
||||
{
|
||||
float currentAngle = -halfAngle + step * i;
|
||||
Vector3 currDir = Quaternion.AngleAxis(currentAngle, Vector3.up) * transform.forward;
|
||||
Vector3 currPoint = origin + currDir.normalized * _data.radius;
|
||||
Gizmos.DrawLine(prevPoint, currPoint);
|
||||
prevPoint = currPoint;
|
||||
}
|
||||
|
||||
// 마지막 라인
|
||||
Gizmos.DrawLine(origin, prevPoint);
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e77da766410d47f9a7effebd30fd33f6
|
||||
timeCreated: 1745394588
|
@ -0,0 +1,57 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class VerticalAoeController : AoeControllerBase
|
||||
{
|
||||
|
||||
protected override void ShowWarningEffect()
|
||||
{
|
||||
if (warningEffectInstance != null)
|
||||
warningEffectInstance.SetActive(true);
|
||||
|
||||
var centerCap = Vector3.forward * _data.radius;
|
||||
float diameter = _data.radius * 2f;
|
||||
transform.localScale = new Vector3(_data.radius, 1f, diameter);
|
||||
transform.Translate(centerCap, Space.Self);
|
||||
}
|
||||
|
||||
protected override void ShowDamageEffect()
|
||||
{
|
||||
// 폭발 이펙트 생성
|
||||
if (_data.explosionEffectPrefab != null)
|
||||
{
|
||||
var effect = Instantiate(_data.explosionEffectPrefab, transform.position, transform.rotation);
|
||||
effect.transform.localScale = new Vector3(_data.radius, _data.radius, _data.radius);
|
||||
Destroy(effect, 2f);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void HitCheck()
|
||||
{
|
||||
// 박스 판정 (사각형 직선)
|
||||
Vector3 halfExtents = new Vector3(_data.radius, 1f, _data.radius * 2f);
|
||||
Collider[] hits = Physics.OverlapBox(transform.position, halfExtents, transform.rotation, _data.targetLayer);
|
||||
|
||||
foreach (var hit in hits)
|
||||
{
|
||||
if (!hit.CompareTag("Player")) continue;
|
||||
Debug.Log($"{hit.name} 사각형 범위에 있어 데미지 적용");
|
||||
// TODO: 데미지 로직
|
||||
// 임시 데이미 처리 로직
|
||||
PlayerController playerController = hit.transform.GetComponent<PlayerController>();
|
||||
if (playerController != null)
|
||||
{
|
||||
playerController.TakeDamage(_data.damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
Gizmos.color = Color.red;
|
||||
Vector3 center = transform.position;
|
||||
Vector3 size = new Vector3(_data.radius, 1f, _data.radius * 2f);
|
||||
Gizmos.matrix = Matrix4x4.TRS(center, transform.rotation, Vector3.one);
|
||||
Gizmos.DrawWireCube(Vector3.zero, size);
|
||||
Gizmos.matrix = Matrix4x4.identity;
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8eb40ee5f0d943469026d2b6522dbe46
|
||||
timeCreated: 1745393484
|
@ -1,14 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyAnimatorStateAttack : StateMachineBehaviour
|
||||
{
|
||||
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
|
||||
// override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
|
||||
// {
|
||||
// animator.gameObject.GetComponent<EnemyController>().SetState(EnemyState.Trace);
|
||||
// }
|
||||
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnemyAttackController : MonoBehaviour
|
||||
{
|
||||
[Header("각종 전조 오브젝트")]
|
||||
[SerializeField] private GameObject verticalWarningArea;
|
||||
[SerializeField] private GameObject horizontalWarningArea;
|
||||
[SerializeField] private GameObject chariotWarningArea;
|
||||
[SerializeField] private GameObject dynamoWarningArea;
|
||||
|
||||
// 배열에 담아서 관리
|
||||
private List<GameObject> warningAreas;
|
||||
private GameObject _activeArea;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
warningAreas = new List<GameObject>()
|
||||
{
|
||||
verticalWarningArea,
|
||||
horizontalWarningArea,
|
||||
chariotWarningArea,
|
||||
dynamoWarningArea
|
||||
};
|
||||
}
|
||||
|
||||
// 랜덤 전조 호출
|
||||
public void TriggerRandomWarning(Vector3 spawnPosition, Quaternion spawnRotation)
|
||||
{
|
||||
// 0 ~ Count-1 사이 랜덤 인덱스
|
||||
int idx = Random.Range(0, warningAreas.Count);
|
||||
GameObject selected = warningAreas[idx];
|
||||
|
||||
// 예시: Instantiate 방식으로 화면에 띄우기
|
||||
_activeArea = Instantiate(selected, spawnPosition, spawnRotation);
|
||||
}
|
||||
|
||||
public void DestroyWarningArea()
|
||||
{
|
||||
Destroy(_activeArea);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user