Merge branch 'main' into DEG-21-던전-로직-구현

This commit is contained in:
Sehyeon 2025-04-24 14:03:46 +09:00
commit fc59d0c260
160 changed files with 4387 additions and 1958 deletions

View File

@ -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/Attack01.anim (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c25471f7e975de140af2a11af5aa791a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/JAY/Animation/Attack02.anim (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2c17f0c4e3017bb448ff5120b9f61794
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/JAY/Animation/Attack03.anim (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 23ef3f3f7e8603c43b49b5a12de765cf
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/JAY/Animation/Attack04.anim (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee0fb1c70ff918147854e2fa7f8ce65d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

View 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: UpperBodyOnly
m_Mask: 00000000010000000100000000000000000000000100000001000000010000000100000000000000000000000100000001000000
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

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7a5307288916a174ab64fb7c68209bac
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 31900000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

BIN
Assets/JAY/HousingUI.unity (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Assets/JAY/Prefabs/WoodChopstick.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e9e020ef2784edf4ca2a83ae9e1edefd
guid: 31f394375ca23d74e82ded5b2efca2b6
PrefabImporter:
externalObjects: {}
userData:

BIN
Assets/JAY/Prefabs/woodChopstick.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,109 @@
fileFormatVersion: 2
guid: 72a88a4cb2c991b48a9c7ebd8f1a5065
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: 1
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: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0d821074393d4e97aa21ac0fb2cb40d9
timeCreated: 1745375836

View File

@ -0,0 +1,6 @@
public interface IPlayerAction {
void StartAction(PlayerController player);
void UpdateAction();
void EndAction();
bool IsActive { get; }
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d66c33c9a4ef493f9522d78f41b3778f
timeCreated: 1745375851

View File

@ -0,0 +1,58 @@
using UnityEngine;
public class PlayerActionAttack : IPlayerAction {
private PlayerController player;
private int comboStep = 1;
private bool comboQueued = false;
private bool canReceiveCombo = false;
public bool IsActive { get; private set; }
public void StartAction(PlayerController player) {
this.player = player;
IsActive = true;
comboStep = 1;
comboQueued = false;
PlayComboAnimation(comboStep);
player.PlayerAnimator.SetBool("Attack", true);
}
public void UpdateAction() {
if (Input.GetKeyDown(KeyCode.X) && canReceiveCombo) {
comboQueued = true;
}
}
public void EndAction() {
player.PlayerAnimator.SetBool("Attack", false);
IsActive = false;
player = null;
}
public void EnableCombo() {
canReceiveCombo = true;
}
public void DisableCombo() {
canReceiveCombo = false;
if (comboQueued && comboStep < 4) {
comboStep++;
PlayComboAnimation(comboStep);
comboQueued = false;
} else {
EndAction(); // 행동 종료
}
}
private void PlayComboAnimation(int step) {
player.PlayerAnimator.SetInteger("ComboStep", step);
// 무기에 콤보 단계 전달
var weapon = player.GetComponentInChildren<WeaponController>();
if (weapon != null)
{
weapon.SetComboStep(step);
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 0513c92d4bea436fb9be539a2f3ad0e3
timeCreated: 1745375880

View File

@ -1,29 +1,32 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum PlayerState { None, Idle, Move, Attack, Hit, Dead }
public enum PlayerState { None, Idle, Move, Hit, Dead }
public class PlayerController : CharacterBase
public class PlayerController : CharacterBase, IObserver<GameObject>
{
// 외부 접근 가능 변수
[Header("Movement")]
[SerializeField] private float rotationSpeed = 10f;
[Header("Attach Points")]
[SerializeField] private Transform rightHandTransform;
[SerializeField] private Transform headTransform;
// 내부에서만 사용하는 변수
private CharacterController _characterController;
private bool _isBattle;
private GameObject weapon;
private WeaponController _weaponController;
private IPlayerState CurrentStateClass { get; set; }
private IPlayerAction currentAction;
// 상태 관련
private PlayerStateIdle _playerStateIdle;
private PlayerStateMove _playerStateMove;
// 행동 관련
private PlayerActionAttack attackAction;
// 외부에서도 사용하는 변수
public FixedJoystick joystick { get; private set; }
public PlayerState CurrentState { get; private set; }
@ -40,9 +43,11 @@ public class PlayerController : CharacterBase
joystick = FindObjectOfType<FixedJoystick>();
}
}
private void Start()
protected override void Start()
{
base.Start();
// 상태 초기화
_playerStateIdle = new PlayerStateIdle();
_playerStateMove = new PlayerStateMove();
@ -52,7 +57,9 @@ public class PlayerController : CharacterBase
{ PlayerState.Idle, _playerStateIdle },
{ PlayerState.Move, _playerStateMove },
};
attackAction = new PlayerActionAttack();
PlayerInit();
}
@ -62,6 +69,21 @@ public class PlayerController : CharacterBase
{
_playerStates[CurrentState].Update();
}
// 현재 액션이 활성화 되어 있으면 Update 호출
if (currentAction != null && currentAction.IsActive) {
currentAction.UpdateAction();
}
// 공격 입력 처리
if (Input.GetKeyDown(KeyCode.X) && (currentAction == null || !currentAction.IsActive)) {
StartAttackAction();
}
}
public void StartAttackAction() {
currentAction = attackAction;
currentAction.StartAction(this);
}
#region
@ -71,7 +93,6 @@ public class PlayerController : CharacterBase
SetState(PlayerState.Idle);
InstantiateWeapon();
weapon.SetActive(_isBattle);
}
private void InstantiateWeapon()
@ -80,11 +101,12 @@ public class PlayerController : CharacterBase
{
GameObject weaponObject = Resources.Load<GameObject>("Player/Weapon/Chopstick");
weapon = Instantiate(weaponObject, rightHandTransform);
// .GetComponent<WeaponController>();
_weaponController = weapon?.GetComponent<WeaponController>();
_weaponController?.Subscribe(this);
weapon?.SetActive(_isBattle);
}
}
#endregion
public void SetState(PlayerState state)
@ -94,12 +116,49 @@ public class PlayerController : CharacterBase
_playerStates[CurrentState].Exit();
}
CurrentState = state;
_playerStates[CurrentState].Enter(this);
CurrentStateClass = _playerStates[state];
CurrentStateClass.Enter(this);
}
public void SwitchBattleMode()
{
_isBattle = !_isBattle;
weapon.SetActive(_isBattle);
}
// Animation Event에서 호출될 메서드
public void SetAttackComboTrue() {
if (_weaponController.IsAttacking) return; // 이미 공격 중이면 실행 안함
if (currentAction == attackAction) {
attackAction.EnableCombo();
_weaponController.AttackStart();
}
}
public void SetAttackComboFalse() {
if (currentAction == attackAction) {
attackAction.DisableCombo();
_weaponController.AttackEnd();
}
}
#region IObserver
public void OnNext(GameObject value)
{
Debug.Log("무기 타격");
float playerAttackPower = _weaponController.AttackPower * attackPower; // 플레이어 공격 데미지(막타는 일반 데미지의 4배)
}
public void OnError(Exception error)
{
}
public void OnCompleted()
{
_weaponController.Unsubscribe(this);
}
#endregion
}

View File

@ -21,8 +21,7 @@ public class PlayerControllerEditor : Editor
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.LabelField("현재 상태", playerController.CurrentState.ToString(),
EditorStyles.boldLabel);
EditorGUILayout.LabelField("현재 상태", playerController.CurrentState.ToString(), EditorStyles.boldLabel);
EditorGUILayout.EndVertical();
@ -39,8 +38,6 @@ public class PlayerControllerEditor : Editor
if (GUILayout.Button("BattleMode"))
playerController.SwitchBattleMode();
// if (GUILayout.Button("Attack"))
// playerController.SetState(PlayerState.Attack);
// if (GUILayout.Button("Hit"))
// playerController.SetState(PlayerState.Hit);
// if (GUILayout.Button("Dead"))

View File

@ -7,7 +7,6 @@ public class PlayerStateIdle : IPlayerState
public void Enter(PlayerController playerController)
{
_playerController = playerController;
// _playerController.Animator.SetBool("Idle", true);
}
public void Update()
@ -19,7 +18,6 @@ public class PlayerStateIdle : IPlayerState
if (inputHorizontal != 0 || inputVertical != 0)
{
_playerController.SetState(PlayerState.Move);
return;
}
}

View File

@ -16,12 +16,11 @@ public class PlayerStateMove : IPlayerState
{
float inputHorizontal = _playerController.joystick.Horizontal;
float inputVertical = _playerController.joystick.Vertical;
// 이동
if (inputHorizontal != 0 || inputVertical != 0)
{
HandleMovement();
return;
}
else
{
@ -60,7 +59,5 @@ public class PlayerStateMove : IPlayerState
Vector3 finalMove = (move + _gravityVelocity) * Time.deltaTime;
_playerController.CharacterController.Move(finalMove);
// _playerController.PlayerAnimator.SetFloat("Move", _playerController.CharacterController.velocity.magnitude);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e8c373d7c1104f62b6ff1848bcc6b3f1
timeCreated: 1745283320

View File

@ -0,0 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IObservable<T>
{
public void Subscribe(IObserver<T> observer);
public void Unsubscribe(IObserver<T> observer);
public void Notify(T value);
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7db2e89701864527b193c3c5b241ca76
timeCreated: 1745283381

View File

@ -0,0 +1,11 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public interface IObserver<T>
{
public void OnNext(T value);
public void OnError(Exception error);
public void OnCompleted();
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 739f14653b804ce4a07632994722e3d6
timeCreated: 1745283352

View File

@ -0,0 +1,186 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WeaponController : MonoBehaviour, IObservable<GameObject>
{
[Serializable]
public class WeaponTriggerZone
{
public Vector3 position;
public float radius;
}
[SerializeField] private WeaponTriggerZone[] _triggerZones;
[SerializeField] private LayerMask targetLayerMask;
private List<IObserver<GameObject>> _observers = new List<IObserver<GameObject>>();
// 공격 데미지 처리
private int attackPower = 1;
private int _comboStep = 1;
public int AttackPower // 플레이어 공격 데미지
{
get
{
// 마지막 콤보일 경우 공격력 증가
return _comboStep == 4 ? attackPower * 4 : attackPower;
}
}
private PlayerController _playerController;
private bool _isAttacking = false;
public bool IsAttacking => _isAttacking;
// 충돌 처리
private Vector3[] _previousPositions;
private HashSet<Collider> _hitColliders;
private Ray _ray = new Ray();
private RaycastHit[] _hits = new RaycastHit[10];
private void Start()
{
if (_triggerZones == null || _triggerZones.Length == 0)
{
Debug.LogWarning("Trigger Zones이 설정되지 않았습니다.");
return;
}
_playerController = GetComponent<PlayerController>();
_previousPositions = new Vector3[_triggerZones.Length];
_hitColliders = new HashSet<Collider>();
}
public void AttackStart()
{
if (_hitColliders == null)
{
Debug.LogError("_hitColliders가 null입니다. 무기를 들고 있는지 확인해 주세요!");
return;
}
_isAttacking = true;
_hitColliders.Clear();
for (int i = 0; i < _triggerZones.Length; i++)
{
_previousPositions[i] = transform.position + transform.TransformVector(_triggerZones[i].position);
}
}
public void AttackEnd()
{
_isAttacking = false;
}
private void FixedUpdate()
{
if (_isAttacking)
{
for (int i = 0; i < _triggerZones.Length; i++)
{
var worldPosition = transform.position +
transform.TransformVector(_triggerZones[i].position);
var direction = worldPosition - _previousPositions[i];
_ray.origin = _previousPositions[i];
_ray.direction = direction;
if (direction.magnitude < 0.01f) return;
var hitCount = Physics.SphereCastNonAlloc(_ray,
_triggerZones[i].radius, _hits,
direction.magnitude, targetLayerMask,
QueryTriggerInteraction.UseGlobal);
for (int j = 0; j < hitCount; j++)
{
var hit = _hits[j];
if (!_hitColliders.Contains(hit.collider))
{
_hitColliders.Add(hit.collider);
Notify(hit.collider.gameObject);
}
}
_previousPositions[i] = worldPosition;
}
}
}
private IEnumerator ResumeTimeScale()
{
yield return new WaitForSecondsRealtime(10f);
Time.timeScale = 1f;
}
public void Subscribe(IObserver<GameObject> observer)
{
if (!_observers.Contains(observer))
{
_observers.Add(observer);
}
}
public void Unsubscribe(IObserver<GameObject> observer)
{
_observers.Remove(observer);
}
public void Notify(GameObject value)
{
foreach (var observer in _observers)
{
observer.OnNext(value);
}
}
private void OnDestroy()
{
var copyObservers = new List<IObserver<GameObject>>(_observers);
foreach (var observer in copyObservers)
{
observer.OnCompleted();
}
_observers.Clear();
}
public void SetComboStep(int step)
{
_comboStep = step;
}
#if UNITY_EDITOR
private void OnDrawGizmos()
{
if (_triggerZones == null) return;
if (_isAttacking && _previousPositions != null)
{
for (int i = 0; i < _triggerZones.Length; i++)
{
if (_triggerZones[i] == null) continue;
var worldPosition = transform.position +
transform.TransformVector(_triggerZones[i].position);
var direction = worldPosition - _previousPositions[i];
Gizmos.color = Color.green;
Gizmos.DrawWireSphere(worldPosition, _triggerZones[i].radius);
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(worldPosition + direction, _triggerZones[i].radius);
}
}
else
{
foreach (var triggerZone in _triggerZones)
{
if (triggerZone == null) continue;
Gizmos.color = Color.green;
Gizmos.DrawSphere(triggerZone.position, triggerZone.radius);
}
}
}
#endif
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 14a4a5b667c44deaac42b0a5b624aaaf
timeCreated: 1745289551

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2c820602050ac1d4b907f11034ef95ad
guid: ac3af37988877784e91ab90c4ade37d9
folderAsset: yes
DefaultImporter:
externalObjects: {}

BIN
Assets/JYY/Models/Y Bot.fbx (Stored with Git LFS) Normal file

Binary file not shown.

View 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)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44d67bf59c049fb46876a549120a16d7
guid: 0e60f1766f73dbc439ff69a154cc9a99
PrefabImporter:
externalObjects: {}
userData:

Binary file not shown.

View File

@ -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

Binary file not shown.

BIN
Assets/JYY/Prefabs/AoE Indicator Horizontal.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cdfd96e94fec4014989e36f19373adb2
guid: 44d67bf59c049fb46876a549120a16d7
PrefabImporter:
externalObjects: {}
userData:

BIN
Assets/JYY/Prefabs/AoE Indicator Vertical.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View 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

Binary file not shown.

View 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

Binary file not shown.

View 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

Binary file not shown.

View 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

Binary file not shown.

View 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

Binary file not shown.

View 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)

Binary file not shown.

BIN
Assets/JYY/Scenes/MonsterTest.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -1,23 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class JoystickPanelController : MonoBehaviour
{
public void OnClickAttackButton()
{
}
public void OnClickDashButton()
{
}
public void OnClickInteractionButton()
{
}
}

8
Assets/KJM.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dbfd37452c39a544895c4f842901be82
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/KJM/KJM.unity (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fce4c0b08a429b64695c3c0aed06df0f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/KJM/KJM_Test.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cf313a0298660aa4db16ced680557810
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,43 @@
using System;
using UnityEngine;
// 던전 관련 저장 데이터
[Serializable]
public class DungeonSave
{
// 강화 수치
public int attackLevel;
public int attackSpeedLevel;
public int heartLevel;
public int moveSpeedLevel;
public int evasionTimeLevel;
// 현재 진행 중인 스테이지
public int stageLevel;
}
// 일상(자취방) 관련 저장 데이터
[Serializable]
public class HomeSave
{
// 일상 시간
public float time;
public int day;
// 체력 및 평판 수치
public float health;
public float reputation;
//이벤트
public bool isEvent;
public int mealCount;
public int houseworkCount;
}
// 게임 전체 저장 구조
[Serializable]
public class Save
{
public HomeSave homeSave;
public DungeonSave dungeonSave;
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a5765847dbef51e4f9bccde712eeda30
guid: 883ac325bc606014fa78662a7b7ec954
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,188 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using CI.QuickSave;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SaveManager : Singleton<SaveManager>
{
private const string SaveFolder = "QuickSave";
private string MainSaveFilePath => GetSavePath("Save_Main");
private string BackupSaveFilePath => GetSavePath("Save_Backup");
private Save mainSave;
private Save backupSave;
void Start()
{
Load(); //저장된 메인,백업 세이브를 로드
}
public void Save()
{
if(JsonUtility.ToJson(mainSave) == JsonUtility.ToJson(StatManager.instance.ToSaveData())) //같은 상태는 저장되지 않음. 백업 덮어쓰기 방지.
return;
EnsureSaveExists();
backupSave = LoadMain(); //메인 세이브를 백업 세이브에 로드
SaveBackup(); //백업 세이브 저장
UpdateSaveInfo(); //세이브를 현재 정보로 업데이트
SaveMain(); //메인 세이브 저장
Debug.Log("세이브 되었습니다.");
}
public void Load()
{
EnsureSaveExists();
mainSave = LoadMain();
backupSave = LoadBackup();
StatManager.instance.loadSaveData2StataManager(mainSave);
Debug.Log("메인 로드" + mainSave.homeSave.reputation); //임시 코드
Debug.Log("백업 로드" + backupSave.homeSave.reputation); //임시 코드
}
private void UpdateSaveInfo()
{
mainSave = StatManager.instance.ToSaveData(); //스탯을 관리하는 클래스에 선언된 스탯 업데이트 함수를 호출
}
private void SaveMain()
{
QuickSaveWriter.Create("Save_Main")
.Write("Main", mainSave)
.Commit();
}
private void SaveBackup()
{
QuickSaveWriter.Create("Save_Backup")
.Write("Backup", backupSave)
.Commit();
}
private Save LoadMain()
{
try
{
return QuickSaveReader.Create("Save_Main").Read<Save>("Main");
}
catch (System.Exception e)
{
Debug.LogWarning("Main 세이브 로드 실패: " + e.Message);
// 백업 시도
if (QuickSaveRaw.Exists(BackupSaveFilePath))
{
Debug.LogWarning("백업 세이브로 복구 시도");
return LoadBackup();
}
// 백업도 없을 경우 새 세이브 생성
Debug.LogError("세이브 전체 손상 → 새 세이브 생성");
return CreateNewSave();
}
}
private Save LoadBackup()
{
try
{
return QuickSaveReader.Create("Save_Backup").Read<Save>("Backup");
}
catch (System.Exception e)
{
Debug.LogWarning("Backup 세이브 로드 실패: " + e.Message);
// 백업 시도
if (QuickSaveRaw.Exists(MainSaveFilePath))
{
Debug.LogWarning("메인 세이브로 복구 시도");
return LoadMain();
}
// 메인도 없을 경우 새 세이브 생성
Debug.LogError("세이브 전체 손상 → 새 세이브 생성");
return CreateNewSave();
}
}
//더미 세이브 파일 생성
private Save CreateNewSave()
{
var fresh = StatManager.instance.ToSaveData();
SaveMain();
SaveBackup();
return fresh;
}
//세이브 파일의 존재 여부 확인
private void EnsureSaveExists()
{
if (!QuickSaveRaw.Exists(MainSaveFilePath)) // Save_Main 파일이 없을때
{
if (!QuickSaveRaw.Exists(BackupSaveFilePath)) //Save_Backup 파일도 존재하지 않을때
{
UpdateSaveInfo();
SaveMain(); //Save_Main 파일 생성
backupSave = LoadMain();
SaveBackup(); //Save_Backup 파일 생성
Debug.Log("세이브가 존재하지 않아 새로운 세이브를 생성했습니다.");
}
else
{
mainSave = LoadBackup(); //백업을 메인으로 로드.
SaveMain();
Debug.Log("메인을 백업 세이브로 로드했습니다.");
}
}
else
{
if (!QuickSaveRaw.Exists(BackupSaveFilePath)) //Save_Backup 파일이 없을떄
{
backupSave = LoadMain();
SaveBackup();
Debug.Log("백업을 메인 세이브로 로드했습니다.");
}
}
}
//세이브 파일 디렉토리 확인
private string GetSavePath(string fileNameWithoutExt)
{
string directory = Path.Combine(Application.persistentDataPath, SaveFolder);
// 폴더가 없다면 생성
if (!Directory.Exists(directory))
Directory.CreateDirectory(directory);
return Path.Combine(directory, fileNameWithoutExt + ".json");
}
// 씬이 바뀔 때 마다 자동저장
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
StartCoroutine(SaveAfterOneFrame());
}
//Start함수 이후에 호출되도록 1프레임 지연
IEnumerator SaveAfterOneFrame()
{
yield return null;
Save();
Debug.Log("자동저장 되었습니다.");
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9c85bf88c19d95947bc288da9dfd85bf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,120 @@
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");
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: afa35303e7c5e6141b05a11a7b5233ce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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(interactionType);
}
else
{
housingCanvasController.SetActionText(interactionTexts.LackOfHealth);
housingCanvasController.SetDescriptionText();
}
});
}
public Action SuddenEventHappen()
{
return null;
}
public void SuddenAfterWorkEventHappen()
{
AfterWorkEvent afterWorkEvent = _suddenEventController.SuddenEventCalculator();
if (afterWorkEvent == AfterWorkEvent.None)
return;
switch (afterWorkEvent)
{
case AfterWorkEvent.OvertimeWork:
housingCanvasController.ShowSuddenEventPanel("부장님이 퇴근을 안하셔.. 야근할까?", () =>
{
playerStats.PerformAction(ActionType.Sleep);
housingCanvasController.HideInteractionButton();
//TODO: 화면 전환 효과와 UI 업데이트 작업
//Todo: 컷씬과 스테이터스 변경
housingCanvasController.HideSuddenEventPanel();
});
break;
case ActionType.Housework:
housingCanvasController.ShowInteractionButton("밀린 집안일을 처리할까?","체력 1을 사용하고 좋은일이 일어날지도 모른다", () =>
case AfterWorkEvent.TeamGathering:
housingCanvasController.ShowSuddenEventPanel("갑자기 팀 회식이 잡혔다. 참석 하러 가자", () =>
{
if (playerStats.CanPerformByHealth(ActionType.Housework))
{
playerStats.PerformAction(ActionType.Housework);
housingCanvasController.HideInteractionButton();
//TODO: 집안일 후 랜덤 강화 효과 적용
}
else
{
housingCanvasController.SetActionText("힘들어서 못해..");
housingCanvasController.SetDescriptionText();
}
housingCanvasController.HideSuddenEventPanel();
});
break;
case ActionType.Dungeon:
housingCanvasController.ShowInteractionButton("던전에 입장할까?","체력 3을 사용하고 3시간이 흐른다.", () =>
{
if (playerStats.CanPerformByHealth(ActionType.Dungeon))
{
playerStats.PerformAction(ActionType.Dungeon);
housingCanvasController.HideInteractionButton();
}
else
{
housingCanvasController.SetActionText("던전에 갈 체력이 되지 않아..");
housingCanvasController.SetDescriptionText();
}
});
break;
case ActionType.Work:
housingCanvasController.ShowInteractionButton("출근한다.","체력 3을 사용하고 저녁 6시에나 돌아오겠지..", () =>
{
if (playerStats.CanPerformByHealth(ActionType.Work))
{
playerStats.PerformAction(ActionType.Work);
housingCanvasController.HideInteractionButton();
}
else
{
housingCanvasController.SetActionText("도저히 출근할 체력이 안되는걸..?");
housingCanvasController.SetDescriptionText();
}
});
break;
default:
break;
}
}
}

BIN
Assets/LIN/Housing Copy.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -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
}

View 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;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: b0ce52df52334b1eaf37479fdda66f7a
timeCreated: 1745303266

View 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);
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 26ce8577425c4630903173b182839514
timeCreated: 1745306651

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 02303d18bbfec0e4b9f6699f1a0152d2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/Materials/Glass.mat (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ecddda1709edab34c820484e3de09bea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/Scenes/HousingUI.unity (Stored with Git LFS)

Binary file not shown.

8
Assets/LYM/Scripts.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bb031fff0dd38c1499e8108a1b04c699
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,113 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ChatWindowController : MonoBehaviour, IPointerClickHandler
{
[SerializeField] private TMP_Text chatText;
[SerializeField] private Image clickIndicator;
private Coroutine _typingCoroutine;
private Coroutine _clickCoroutine;
private string _inputText;
private Queue<string> _inputQueue;
public delegate void OnComplete();
public OnComplete onComplete;
private void Start()
{
Init("마무리", () =>
{
Debug.Log("대화 끝.");
});
ShowText(_inputQueue.Dequeue());
}
public void Init(string text, OnComplete onComplete)
{
_inputQueue = new Queue<string>();
_inputQueue.Enqueue("아 망했어 오늘도 지각이다!!!! 이러면 진짜 해고당할 수도 있어!!!\n어떡하지 큰일이다!!!");
_inputQueue.Enqueue("톼사하셈 ㅋ");
_inputQueue.Enqueue("톼사하셈 ㅋ");
_inputQueue.Enqueue("스킵도 가능 톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ톼사하셈 ㅋ");
_inputQueue.Enqueue(text);
this.onComplete = onComplete;
}
//화면에 표시할 텍스트 삽입 함수
private void ShowText(string text)
{
var clickIndicatorColor = clickIndicator.color;
clickIndicatorColor.a = 1;
clickIndicator.color = clickIndicatorColor;
_inputText = text;
if (_typingCoroutine != null)
{
StopCoroutine(_typingCoroutine);
}
_typingCoroutine = StartCoroutine(TypingEffectCoroutine(_inputText));
}
//텍스트 타이핑효과 코루틴
private IEnumerator TypingEffectCoroutine(string text)
{
StringBuilder strText = new StringBuilder();
for (int i = 0; i < text.Length; i++)
{
strText.Append(text[i]);
chatText.text = strText.ToString();
yield return new WaitForSeconds(0.1f);
}
_clickCoroutine = StartCoroutine(ClickIndicatorCoroutine());
_typingCoroutine = null;
}
private IEnumerator ClickIndicatorCoroutine()
{
bool flag = true;
var clickIndicatorColor = clickIndicator.color;
while (true)
{
clickIndicatorColor.a = flag? 0:1;
flag = !flag;
clickIndicator.color = clickIndicatorColor;
yield return new WaitForSeconds(0.5f);
}
}
//대화창 클릭 시 호출 함수
public void OnPointerClick(PointerEventData eventData)
{
if (_typingCoroutine != null)
{
StopCoroutine(_typingCoroutine);
_typingCoroutine = null;
chatText.text = _inputText;
_clickCoroutine = StartCoroutine(ClickIndicatorCoroutine());
}
else
{
if (_clickCoroutine != null)
{
StopCoroutine(_clickCoroutine);
_clickCoroutine = null;
}
if (_inputQueue.Count > 0)
{
ShowText(_inputQueue.Dequeue());
}
else
{
onComplete?.Invoke();
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6d08eed775f1044ea141c88554ab445
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,83 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
//로딩 상황
public enum LoadingState
{
Housework,
Go2Work,
LeaveWork,
Meal,
Dungeon
}
//집안일 목록
public enum HouseworkState
{
Laundry,
Cleaning,
}
public class InteractionPanelController : MonoBehaviour
{
[SerializeField] private Image doingImage;
[SerializeField] private TMP_Text doingText;
[SerializeField] private Animator animator;
private Coroutine _textAnimCoroutine;
private void Start()
{
Init(LoadingState.Housework);
}
private void Init(LoadingState state)
{
if (_textAnimCoroutine != null)
{
StopCoroutine(_textAnimCoroutine);
}
switch (state)
{
case LoadingState.Housework:
doingText.text = "세탁하는 중";
animator.Play("Laundry");
break;
case LoadingState.Go2Work:
doingText.text = "출근하는 중";
break;
case LoadingState.LeaveWork:
doingText.text = "퇴근하는 중";
break;
case LoadingState.Meal:
doingText.text = "식사하는 중";
break;
case LoadingState.Dungeon:
doingText.text = "던전 진입하는 중";
break;
}
_textAnimCoroutine = StartCoroutine(TextAnimation());
}
private IEnumerator TextAnimation()
{
var tempText = doingText.text;
float startTime = Time.time;
while (Time.time - startTime < 3)
{
for (int i = 0; i < 3; i++)
{
yield return new WaitForSeconds(0.3f);
doingText.text = tempText + new string('.', i + 1);
}
yield return new WaitForSeconds(0.3f);
}
_textAnimCoroutine = null;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1cce2eaa9f91c4439ec1749048f2df1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEditor.SearchService;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class JoystickPanelController : MonoBehaviour
{
[SerializeField] private GameObject dungeonUI;
[SerializeField] private GameObject housingUI;
private void Start()
{
dungeonUI.SetActive(false);
housingUI.SetActive(false);
//현재 씬 이름 확인해 UI 별 활성화 판단
string sceneName = SceneManager.GetActiveScene().name;
switch (sceneName)
{
case "HousingUI":
housingUI.SetActive(true);
break;
case "DungeonUI":
dungeonUI.SetActive(true);
break;
}
}
public void OnClickAttackButton()
{
}
public void OnClickDashButton()
{
}
public void OnClickInteractionButton()
{
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class StatsPanelController : MonoBehaviour
{
[SerializeField] private Slider healthSlider;
[SerializeField] private Slider reputationSlider;
[SerializeField] private TMP_Text healthText;
[SerializeField] private TMP_Text reputationText;
[SerializeField] private TMP_Text timeText;
[SerializeField] private TMP_Text ampmText;
[SerializeField] private TMP_Text numberText;
private void Awake()
{
healthSlider.interactable = false;
reputationSlider.interactable = false;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 20ed70d0d6c60894e9186cf3c49b818b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/Sprites/2.5dButton.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 41c9ad4658536b84bb74af1668e1dd4f
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
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: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 229, y: 228, z: 228, w: 229}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
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: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LYM/Sprites/38x38dot4slice.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,114 @@
fileFormatVersion: 2
guid: 11fd25addefb2b5488766d5aed986d56
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
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: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 19, y: 19, z: 19, w: 19}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
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: 1
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
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 1537655665
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e8e331d76d1397e47ae67df998b5c284
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More