Genesis Game Client Project Setup
This commit is contained in:
56
.gitattributes
vendored
Normal file
56
.gitattributes
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
## Unity ##
|
||||
|
||||
*.cs diff=csharp text
|
||||
*.cginc text
|
||||
*.shader text
|
||||
|
||||
*.mat merge=unityyamlmerge eol=lf
|
||||
*.unity merge=unityyamlmerge eol=lf
|
||||
*.prefab merge=unityyamlmerge eol=lf
|
||||
*.physicsMaterial2D merge=unityyamlmerge eol=lf
|
||||
*.physicMaterial merge=unityyamlmerge eol=lf
|
||||
*.asset merge=unityyamlmerge eol=lf
|
||||
*.meta merge=unityyamlmerge eol=lf
|
||||
*.controller merge=unityyamlmerge eol=lf
|
||||
|
||||
|
||||
## git-lfs ##
|
||||
|
||||
*.anim filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#Image
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
||||
*.ai filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#Audio
|
||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#Video
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mov filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#3D Object
|
||||
*.FBX filter=lfs diff=lfs merge=lfs -text
|
||||
*.fbx filter=lfs diff=lfs merge=lfs -text
|
||||
*.blend filter=lfs diff=lfs merge=lfs -text
|
||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
#ETC
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
*.exr filter=lfs diff=lfs merge=lfs -text
|
||||
*.tga filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.unitypackage filter=lfs diff=lfs merge=lfs -text
|
||||
*.aif filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.rns filter=lfs diff=lfs merge=lfs -text
|
||||
*.reason filter=lfs diff=lfs merge=lfs -text
|
||||
*.lxo filter=lfs diff=lfs merge=lfs -text
|
||||
75
.gitignore
vendored
Normal file
75
.gitignore
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
# ---> Unity
|
||||
# This .gitignore file should be placed at the root of your Unity project directory
|
||||
#
|
||||
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
|
||||
#
|
||||
/[Ll]ibrary/
|
||||
/[Tt]emp/
|
||||
/[Oo]bj/
|
||||
/[Bb]uild/
|
||||
/[Bb]uilds/
|
||||
/[Ll]ogs/
|
||||
/[Uu]ser[Ss]ettings/
|
||||
|
||||
# MemoryCaptures can get excessive in size.
|
||||
# They also could contain extremely sensitive data
|
||||
/[Mm]emoryCaptures/
|
||||
|
||||
# Recordings can get excessive in size
|
||||
/[Rr]ecordings/
|
||||
|
||||
# Uncomment this line if you wish to ignore the asset store tools plugin
|
||||
# /[Aa]ssets/AssetStoreTools*
|
||||
|
||||
# Autogenerated Jetbrains Rider plugin
|
||||
/[Aa]ssets/Plugins/Editor/JetBrains*
|
||||
|
||||
# Visual Studio cache directory
|
||||
.vs/
|
||||
|
||||
# Gradle cache directory
|
||||
.gradle/
|
||||
|
||||
# Autogenerated VS/MD/Consulo solution and project files
|
||||
ExportedObj/
|
||||
.consulo/
|
||||
*.csproj
|
||||
*.unityproj
|
||||
*.sln
|
||||
*.suo
|
||||
*.tmp
|
||||
*.user
|
||||
*.userprefs
|
||||
*.pidb
|
||||
*.booproj
|
||||
*.svd
|
||||
*.pdb
|
||||
*.mdb
|
||||
*.opendb
|
||||
*.VC.db
|
||||
|
||||
# Unity3D generated meta files
|
||||
*.pidb.meta
|
||||
*.pdb.meta
|
||||
*.mdb.meta
|
||||
|
||||
# Unity3D generated file on crash reports
|
||||
sysinfo.txt
|
||||
|
||||
# Builds
|
||||
*.apk
|
||||
*.aab
|
||||
*.unitypackage
|
||||
*.unitypackage.meta
|
||||
*.app
|
||||
|
||||
# Crashlytics generated file
|
||||
crashlytics-build.properties
|
||||
|
||||
# Packed Addressables
|
||||
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
|
||||
|
||||
# Temporary auto-generated Android Assets
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
|
||||
6
.vsconfig
Normal file
6
.vsconfig
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"version": "1.0",
|
||||
"components": [
|
||||
"Microsoft.VisualStudio.Workload.ManagedGame"
|
||||
]
|
||||
}
|
||||
8
Assets/01_Scenes.meta
Normal file
8
Assets/01_Scenes.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0ac903045f697040aaebc74c7641892
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3920
Assets/01_Scenes/GameScene.unity
Normal file
3920
Assets/01_Scenes/GameScene.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/01_Scenes/GameScene.unity.meta
Normal file
7
Assets/01_Scenes/GameScene.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 295a48c23949ef041a46cb20d959d7c1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2147
Assets/01_Scenes/GameStartScene.unity
Normal file
2147
Assets/01_Scenes/GameStartScene.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/01_Scenes/GameStartScene.unity.meta
Normal file
7
Assets/01_Scenes/GameStartScene.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e57137f228f1b14194450a2621eb633
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts.meta
Normal file
8
Assets/02_Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e616091c3eafb9745bdeb0a88f075bc2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/Core.meta
Normal file
8
Assets/02_Scripts/Core.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a13678f9f22ded41938c5cfb9ce0ce6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/02_Scripts/Core/GlobalObject.cs
Normal file
18
Assets/02_Scripts/Core/GlobalObject.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class GlobalObject : MonoBehaviour
|
||||
{
|
||||
private static GlobalObject _instance;
|
||||
void Awake()
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
_instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Core/GlobalObject.cs.meta
Normal file
2
Assets/02_Scripts/Core/GlobalObject.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce3ac8a759b61f0418a6d2b35c91d3df
|
||||
8
Assets/02_Scripts/Core/Utility.meta
Normal file
8
Assets/02_Scripts/Core/Utility.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae3853ab09af7874ebd1fe1a5cd44dec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/02_Scripts/Core/Utility/Util.cs
Normal file
34
Assets/02_Scripts/Core/Utility/Util.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
public static class Util
|
||||
{
|
||||
/// 특정 시간(초) 후에 액션을 실행
|
||||
public static async Awaitable RunDelayed(float delay, Action action, CancellationToken token = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 유니티 전용 비동기 대기
|
||||
await Awaitable.WaitForSecondsAsync(delay, token);
|
||||
|
||||
// 함수 실행
|
||||
action?.Invoke();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 취소되었을 때의 처리 (필요 시)
|
||||
}
|
||||
}
|
||||
|
||||
/// 다음 프레임에 액션을 실행
|
||||
public static async Awaitable RunNextFrame(Action action, CancellationToken token = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
await Awaitable.EndOfFrameAsync(token);
|
||||
action?.Invoke();
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Core/Utility/Util.cs.meta
Normal file
2
Assets/02_Scripts/Core/Utility/Util.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85e909089a6a8a74bb6ea540cfad87b1
|
||||
8
Assets/02_Scripts/DataModels.meta
Normal file
8
Assets/02_Scripts/DataModels.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 78916edaa662e82479ece2e8b6fe8d35
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
7
Assets/02_Scripts/DataModels/Character.cs
Normal file
7
Assets/02_Scripts/DataModels/Character.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Character
|
||||
{
|
||||
public string CharacterCode { get; set; }
|
||||
public string CharacterType { get; set; }
|
||||
}
|
||||
2
Assets/02_Scripts/DataModels/Character.cs.meta
Normal file
2
Assets/02_Scripts/DataModels/Character.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aab31f147ea95eb46a9e7f1a4e6fd694
|
||||
8
Assets/02_Scripts/DataModels/EnemyCharacter.cs
Normal file
8
Assets/02_Scripts/DataModels/EnemyCharacter.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class EnemyCharacter : Character
|
||||
{
|
||||
|
||||
}
|
||||
2
Assets/02_Scripts/DataModels/EnemyCharacter.cs.meta
Normal file
2
Assets/02_Scripts/DataModels/EnemyCharacter.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a2fe40ca04ae7b47878dd39772fbe6a
|
||||
8
Assets/02_Scripts/DataModels/NpcCharacter.cs
Normal file
8
Assets/02_Scripts/DataModels/NpcCharacter.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class NpcCharacter : Character
|
||||
{
|
||||
|
||||
}
|
||||
2
Assets/02_Scripts/DataModels/NpcCharacter.cs.meta
Normal file
2
Assets/02_Scripts/DataModels/NpcCharacter.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a28fac40f4e9574fa811fba06a05308
|
||||
6
Assets/02_Scripts/DataModels/PlayableCharacter.cs
Normal file
6
Assets/02_Scripts/DataModels/PlayableCharacter.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayableCharacter : Character
|
||||
{
|
||||
|
||||
}
|
||||
2
Assets/02_Scripts/DataModels/PlayableCharacter.cs.meta
Normal file
2
Assets/02_Scripts/DataModels/PlayableCharacter.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd53a3017915eb04789ae9ef3b4af682
|
||||
15
Assets/02_Scripts/DataModels/UserCharacter.cs
Normal file
15
Assets/02_Scripts/DataModels/UserCharacter.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class UserCharacter : PlayableCharacter
|
||||
{
|
||||
public int UserCharacterNo { get; set; }
|
||||
public int UserNo { get; set; }
|
||||
public int Lv { get; set; }
|
||||
public int StrStat { get; set; }
|
||||
public int IntStat { get; set; }
|
||||
public int MaxHp { get; set; }
|
||||
public int MaxMp { get; set; }
|
||||
public bool DefaultControl { get; set; }
|
||||
}
|
||||
2
Assets/02_Scripts/DataModels/UserCharacter.cs.meta
Normal file
2
Assets/02_Scripts/DataModels/UserCharacter.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40c16f8f39a76774e91f6f3ee55be2e3
|
||||
8
Assets/02_Scripts/Managers.meta
Normal file
8
Assets/02_Scripts/Managers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1e5f27bc026bf647aac57594e24f5da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/Managers/Global.meta
Normal file
8
Assets/02_Scripts/Managers/Global.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 841d969ef23f1f544811aad5c3f6fcf6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Assets/02_Scripts/Managers/Global/DataManager.cs
Normal file
90
Assets/02_Scripts/Managers/Global/DataManager.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
using Game.Network.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.TextCore.Text;
|
||||
|
||||
public class DataManager : MonoBehaviour
|
||||
{
|
||||
public static DataManager Instance;
|
||||
|
||||
//내 캐릭터들
|
||||
public List<UserCharacter> MyCharacters = new List<UserCharacter>();
|
||||
|
||||
//모든 캐릭터들 데이터(적,NPC,플레이어블)
|
||||
|
||||
public Dictionary<string, PlayableCharacter> PlayableCharacterData = new Dictionary<string, PlayableCharacter>();
|
||||
public Dictionary<string, EnemyCharacter> EnemyCharacterData = new Dictionary<string, EnemyCharacter>();
|
||||
public Dictionary<string, NpcCharacter> NpcCharacterData = new Dictionary<string, NpcCharacter>();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
private async Awaitable Start()
|
||||
{
|
||||
await LoadUserCharacters(1);
|
||||
await LoadPlayableCharacters();
|
||||
}
|
||||
|
||||
public async Awaitable LoadUserCharacters(int userNo)
|
||||
{
|
||||
UserCharacterDTO[] characterDTOs = await NetworkManager.Instance.GetDatabaseData<UserCharacterDTO[]>($"userCharacters/{userNo}");
|
||||
|
||||
if (characterDTOs != null)
|
||||
{
|
||||
MyCharacters.Clear();
|
||||
|
||||
foreach ( UserCharacterDTO characterDTO in characterDTOs )
|
||||
{
|
||||
UserCharacter uc = new UserCharacter();
|
||||
uc.UserCharacterNo = characterDTO.userCharacterNo;
|
||||
uc.UserNo = characterDTO.userNo;
|
||||
uc.CharacterCode = characterDTO.characterCode;
|
||||
uc.Lv = characterDTO.lv;
|
||||
uc.StrStat = characterDTO.strStat;
|
||||
uc.IntStat = characterDTO.intStat;
|
||||
uc.MaxHp = characterDTO.maxHp;
|
||||
uc.MaxMp = characterDTO.maxMp;
|
||||
uc.DefaultControl = characterDTO.defaultControl;
|
||||
|
||||
MyCharacters.Add(uc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("캐릭터 데이터를 불러오지 못했습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
public async Awaitable LoadPlayableCharacters()
|
||||
{
|
||||
PlayableCharacterDTO[] characterDTOs = await NetworkManager.Instance.GetDatabaseData<PlayableCharacterDTO[]>($"playableCharacters");
|
||||
|
||||
if (characterDTOs != null)
|
||||
{
|
||||
PlayableCharacterData.Clear();
|
||||
|
||||
foreach (PlayableCharacterDTO characterDTO in characterDTOs)
|
||||
{
|
||||
PlayableCharacter c = new PlayableCharacter();
|
||||
c.CharacterCode = characterDTO.characterCode;
|
||||
c.CharacterType = characterDTO.characterType;
|
||||
|
||||
PlayableCharacterData.TryAdd(c.CharacterCode, c);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("캐릭터 데이터를 불러오지 못했습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Global/DataManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Global/DataManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c9262ba3475f9d4482097685346b7e5
|
||||
93
Assets/02_Scripts/Managers/Global/GameManager.cs
Normal file
93
Assets/02_Scripts/Managers/Global/GameManager.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GameManager : MonoBehaviour
|
||||
{
|
||||
public static GameManager Instance;
|
||||
|
||||
public LevelManager Level { get; private set; }
|
||||
public CameraManager Camera { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
// 씬이 로드될 때마다 해당 씬에 있는 Manager들을 찾아서 갱신
|
||||
// 없으면 자동으로 null이 들어감
|
||||
Level = FindFirstObjectByType<LevelManager>();
|
||||
Camera = FindFirstObjectByType<CameraManager>();
|
||||
|
||||
if(Level != null) Level.OnSceneLoaded(scene, mode);
|
||||
if(Camera != null) Camera.OnSceneLoaded(scene, mode);
|
||||
|
||||
InputManager.Instance.PlayerInputEnable(true);
|
||||
GlobalUIManager.Instance.SetSceneLoadingActive(false);
|
||||
|
||||
}
|
||||
|
||||
public void RequestSceneChange(string sceneName)
|
||||
{
|
||||
_ = SceneChange(sceneName);
|
||||
}
|
||||
|
||||
private async Awaitable SceneChange(string sceneName)
|
||||
{
|
||||
try
|
||||
{
|
||||
GlobalUIManager.Instance.SetSceneLoadingActive(true);
|
||||
|
||||
AsyncOperation op = SceneManager.LoadSceneAsync(sceneName);
|
||||
|
||||
//자동 전환을 하고 싶지 않을 경우 해당값을 false로 두었다가 true로 바꾸면 그 때 전환됨
|
||||
op.allowSceneActivation = false;
|
||||
|
||||
//화면에 보여줄 로딩 수치
|
||||
float displayProgress = 0f;
|
||||
|
||||
//op.progress 0.9가 데이터 로딩이 끝난 기준 allowSceneActivation이 트루면 바로 다음으로 넘어가면서 op.isDone이 true가 된다.
|
||||
while (op.progress < 0.9f)
|
||||
{
|
||||
//실제 로딩 수치
|
||||
float realProgress = Mathf.Clamp01(op.progress / 0.9f);
|
||||
|
||||
//보여줄 값을 실제값을 향해 부드럽게 이동
|
||||
displayProgress = Mathf.MoveTowards(displayProgress, realProgress, Time.deltaTime * 0.5f);
|
||||
|
||||
// UI에 적용
|
||||
GlobalUIManager.Instance.SetSceneLoadingProgressValue(displayProgress);
|
||||
|
||||
await Awaitable.NextFrameAsync(this.destroyCancellationToken); //자기자신이 파괴될때 토큰에 취소요청을 보냄
|
||||
}
|
||||
|
||||
GlobalUIManager.Instance.SetSceneLoadingProgressValue(1);
|
||||
|
||||
// 잠시 대기했다가 전환
|
||||
await Awaitable.WaitForSecondsAsync(2.0f, this.destroyCancellationToken);
|
||||
|
||||
op.allowSceneActivation = true;
|
||||
|
||||
Debug.Log("씬 전환됨");
|
||||
|
||||
InputManager.Instance.UnPairDevices();
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Debug.Log("씬 전환 작업이 취소됨");
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Global/GameManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Global/GameManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e694f93c42d3334cb7ea4ac25d87b5d
|
||||
205
Assets/02_Scripts/Managers/Global/InputManager.cs
Normal file
205
Assets/02_Scripts/Managers/Global/InputManager.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.Windows;
|
||||
|
||||
public enum InputState { Started, Performing, Canceled }
|
||||
|
||||
public class InputManager : MonoBehaviour
|
||||
{
|
||||
public static InputManager Instance;
|
||||
|
||||
private PlayerInput _playerInput;
|
||||
private InputActionMap _globalInputActionMap;
|
||||
private InputActionMap _uiInputActionMap;
|
||||
private InputActionMap _characterInputActionMap;
|
||||
|
||||
//콜백 이벤트들
|
||||
//캐릭터 조작관련은 따로 분류
|
||||
public event Action<float> OnMouseScrollEvent;
|
||||
public event Action<Vector2> OnMoveEvent;
|
||||
public event Action<InputState> OnSprintEvent;
|
||||
public event Action<InputState> OnJumpEvent;
|
||||
public event Action OnNormalAttackEvent;
|
||||
public event Action OnHeavyAttackEvent;
|
||||
|
||||
//키조작
|
||||
public event Action OnKeyDown_UpArrowEvent;
|
||||
public event Action OnKeyDown_DownArrowEvent;
|
||||
public event Action OnKeyDown_EnterEvent;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
|
||||
_playerInput = GetComponent<PlayerInput>();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetGlobalInputMap("Global");
|
||||
}
|
||||
|
||||
public void UnPairDevices()
|
||||
{
|
||||
if(_playerInput != null)
|
||||
{
|
||||
_playerInput.user.UnpairDevices();
|
||||
PlayerInputEnable(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerInputEnable(bool flag)
|
||||
{
|
||||
_playerInput.enabled = flag;
|
||||
}
|
||||
|
||||
private void SetGlobalInputMap(string mapName)
|
||||
{
|
||||
_globalInputActionMap = _playerInput?.actions?.FindActionMap(mapName);
|
||||
}
|
||||
|
||||
public void SetUIInputMap(string mapName)
|
||||
{
|
||||
_uiInputActionMap = _playerInput?.actions?.FindActionMap(mapName);
|
||||
if (_uiInputActionMap == null) return;
|
||||
|
||||
// 맵 활성화
|
||||
_uiInputActionMap.Enable();
|
||||
|
||||
//바인딩
|
||||
BindActionUI("OnKeyDown_UpArrow", OnKeyDown_UpArrow);
|
||||
BindActionUI("OnKeyDown_DownArrow", OnKeyDown_DownArrow);
|
||||
BindActionUI("OnKeyDown_Enter", OnKeyDown_Enter);
|
||||
|
||||
}
|
||||
|
||||
public void SetCharacterInputMap(string mapName)
|
||||
{
|
||||
_characterInputActionMap = _playerInput?.actions?.FindActionMap(mapName);
|
||||
if (_characterInputActionMap == null) return;
|
||||
|
||||
// 맵 활성화
|
||||
_characterInputActionMap.Enable();
|
||||
|
||||
//바인딩
|
||||
BindActionCharacter("Scroll", OnMouseScroll);
|
||||
BindActionCharacter("Move", OnMove);
|
||||
BindActionCharacter("Sprint", OnSprint);
|
||||
BindActionCharacter("Jump", OnJump);
|
||||
BindActionCharacter("NormalAttack", OnNormalAttack);
|
||||
BindActionCharacter("HeavyAttack", OnHeavyAttack);
|
||||
}
|
||||
|
||||
//매핑용 함수
|
||||
private void BindActionUI(string actionName, Action<InputAction.CallbackContext> callback)
|
||||
{
|
||||
InputAction action = _uiInputActionMap.FindAction(actionName);
|
||||
if (action != null)
|
||||
{
|
||||
action.performed -= callback;
|
||||
action.canceled -= callback;
|
||||
action.started -= callback;
|
||||
|
||||
action.performed += callback;
|
||||
action.canceled += callback;
|
||||
action.started += callback;
|
||||
|
||||
action.Enable();
|
||||
}
|
||||
}
|
||||
private void BindActionCharacter(string actionName, Action<InputAction.CallbackContext> callback)
|
||||
{
|
||||
InputAction action = _characterInputActionMap.FindAction(actionName);
|
||||
if (action != null)
|
||||
{
|
||||
action.performed -= callback;
|
||||
action.canceled -= callback;
|
||||
action.started -= callback;
|
||||
|
||||
action.performed += callback;
|
||||
action.canceled += callback;
|
||||
action.started += callback;
|
||||
|
||||
action.Enable();
|
||||
}
|
||||
}
|
||||
|
||||
#region 캐릭터 조작
|
||||
private void OnMouseScroll(InputAction.CallbackContext ctx)
|
||||
{
|
||||
Vector2 scroll = ctx.ReadValue<Vector2>();
|
||||
OnMouseScrollEvent?.Invoke(scroll.y);
|
||||
}
|
||||
|
||||
private void OnMove(InputAction.CallbackContext ctx)
|
||||
{
|
||||
Vector2 move = ctx.ReadValue<Vector2>();
|
||||
OnMoveEvent?.Invoke(move);
|
||||
}
|
||||
|
||||
private void OnSprint(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if(ctx.performed)
|
||||
{
|
||||
OnSprintEvent?.Invoke(InputState.Performing);
|
||||
}
|
||||
|
||||
if(ctx.canceled)
|
||||
{
|
||||
OnSprintEvent?.Invoke(InputState.Canceled);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnJump(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if(ctx.started)
|
||||
{
|
||||
OnJumpEvent?.Invoke(InputState.Started);
|
||||
}
|
||||
|
||||
if (ctx.canceled)
|
||||
{
|
||||
OnJumpEvent?.Invoke(InputState.Canceled);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNormalAttack(InputAction.CallbackContext ctx)
|
||||
{
|
||||
OnNormalAttackEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void OnHeavyAttack(InputAction.CallbackContext ctx)
|
||||
{
|
||||
OnHeavyAttackEvent?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 키별 조작
|
||||
private void OnKeyDown_UpArrow(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if(ctx.started)
|
||||
OnKeyDown_UpArrowEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void OnKeyDown_DownArrow(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if (ctx.started)
|
||||
OnKeyDown_UpArrowEvent?.Invoke();
|
||||
}
|
||||
|
||||
private void OnKeyDown_Enter(InputAction.CallbackContext ctx)
|
||||
{
|
||||
if (ctx.started)
|
||||
OnKeyDown_EnterEvent?.Invoke();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Global/InputManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Global/InputManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bee5878dce649df468827634987718b7
|
||||
53
Assets/02_Scripts/Managers/Global/NetworkManager.cs
Normal file
53
Assets/02_Scripts/Managers/Global/NetworkManager.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using Game.Network;
|
||||
using Game.Network.DTO;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
public class NetworkManager : MonoBehaviour
|
||||
{
|
||||
public static NetworkManager Instance;
|
||||
|
||||
private string _baseGameDBUrl = "https://localhost:7134/myGame";
|
||||
//private string _baseGameDBUrlHttp = "http://localhost:5281/myGame";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
public async Awaitable<T> GetDatabaseData<T>(string endPoint)
|
||||
{
|
||||
string url = $"{_baseGameDBUrl}/{endPoint}";
|
||||
using UnityWebRequest request = UnityWebRequest.Get(url); //앞의 using은 사용이 끝난(메서드 종료) 외부 리소스 객체들을 알아서 지워주도록 설정하는 예약어이다
|
||||
request.certificateHandler = new BypassCertificate();
|
||||
|
||||
try
|
||||
{
|
||||
await request.SendWebRequest();
|
||||
|
||||
if (request.result == UnityWebRequest.Result.Success)
|
||||
{
|
||||
string json = request.downloadHandler.text;
|
||||
|
||||
ApiResponse<T> container = JsonConvert.DeserializeObject<ApiResponse<T>>(json);
|
||||
Debug.Log($"응답 : data = {container.data}, count = {container.count}, message = {container.message}");
|
||||
|
||||
return container.data;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogException(e);
|
||||
}
|
||||
return default;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Global/NetworkManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Global/NetworkManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 603b990f633737340b3c056ba1cbf300
|
||||
17
Assets/02_Scripts/Managers/Global/SoundManager.cs
Normal file
17
Assets/02_Scripts/Managers/Global/SoundManager.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class SoundManager : MonoBehaviour
|
||||
{
|
||||
public static SoundManager Instance;
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Global/SoundManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Global/SoundManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 571d986dc1fe8bd4aa48335d392008a4
|
||||
8
Assets/02_Scripts/Managers/Local.meta
Normal file
8
Assets/02_Scripts/Managers/Local.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0e25b823a96cca74eaec7a268a6f821c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
37
Assets/02_Scripts/Managers/Local/CameraManager.cs
Normal file
37
Assets/02_Scripts/Managers/Local/CameraManager.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEditor.Rendering;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class CameraManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private PlayerCameraRig _currentCameraRig; //현재 활성화된 플레이어의 카메라 묶음 조종객체
|
||||
|
||||
private float minFOV = 40f;
|
||||
private float maxFOV = 100f;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void SetCameraRig(PlayerCameraRig cameraRig)
|
||||
{
|
||||
_currentCameraRig = cameraRig;
|
||||
}
|
||||
|
||||
public void ZoomCamera(float offset)
|
||||
{
|
||||
_currentCameraRig.CurrentFOV = Mathf.Clamp(_currentCameraRig.CurrentFOV - offset, minFOV,maxFOV);
|
||||
}
|
||||
|
||||
public Vector3 GetViewportPointToRayEndPoint(Vector3 vpPoint,float rayLength)
|
||||
{
|
||||
Ray ray = Camera.main.ViewportPointToRay(vpPoint);
|
||||
return ray.GetPoint(rayLength);
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Local/CameraManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Local/CameraManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f58134c47759c0c42806560eaa79d716
|
||||
146
Assets/02_Scripts/Managers/Local/LevelManager.cs
Normal file
146
Assets/02_Scripts/Managers/Local/LevelManager.cs
Normal file
@@ -0,0 +1,146 @@
|
||||
|
||||
using Game.Network.DTO;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.SceneManagement;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
|
||||
public class LevelManager : MonoBehaviour
|
||||
{
|
||||
#region 플레이어 관련
|
||||
[SerializeField] private GameObject[] _playableCharacterPrefabs; //플레이어가 될수 있는 캐릭터들 프리팹 할당
|
||||
public GameObject[] PlayableCharacterPrefabs { get { return _playableCharacterPrefabs; } private set { _playableCharacterPrefabs = value; } }
|
||||
public GameObject CurrentCharacter { get; private set; } // 현재 캐릭터
|
||||
public PlayerCharacterController CurrentCharacterController { get { return CurrentCharacter?.GetComponent<PlayerCharacterController>(); } } // 현재 캐릭터의 컨트롤러
|
||||
public int CurrentCharacterIdx { get; private set; } //현재캐릭터 인덱스
|
||||
#endregion
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
if (scene.name == "GameStartScene")
|
||||
{
|
||||
InputManager.Instance.SetUIInputMap("IntroUI");
|
||||
}
|
||||
|
||||
if (scene.name == "GameScene")
|
||||
{
|
||||
|
||||
List<UserCharacter> myCharacters = DataManager.Instance.MyCharacters;
|
||||
|
||||
if (myCharacters != null && myCharacters.Count > 0 && PlayableCharacterPrefabs != null && PlayableCharacterPrefabs.Length > 0)
|
||||
{
|
||||
|
||||
Dictionary<string, PlayerCharacterController> playableCharacterPrefabsDic = PlayableCharacterPrefabs
|
||||
.Select(p => p.GetComponent<PlayerCharacterController>())
|
||||
.Where(pcc => pcc != null && pcc.PlayerCharacterIdentity != null)
|
||||
.ToDictionary(pcc => pcc.PlayerCharacterIdentity.CharacterCode, pcc => pcc);
|
||||
|
||||
foreach (UserCharacter uc in myCharacters)
|
||||
{
|
||||
//내가 가진 캐릭터 코드와 일치하는 플레이어블 캐릭터 프리팹 객체들
|
||||
if (playableCharacterPrefabsDic.TryGetValue(uc.CharacterCode, out PlayerCharacterController pcc))
|
||||
{
|
||||
ApplyCharacterInfo(pcc, uc);
|
||||
}
|
||||
}
|
||||
|
||||
bool defaultCharacterFlag = false;
|
||||
|
||||
for (int i = 0; i < PlayableCharacterPrefabs.Length; i++)
|
||||
{
|
||||
|
||||
GameObject pc = PlayableCharacterPrefabs[i];
|
||||
if (pc.TryGetComponent<PlayerCharacterController>(out PlayerCharacterController pcc) && pcc.PlayerCharacterIdentity.IsDefaultControl)
|
||||
{
|
||||
CurrentCharacter = PlayableCharacterPrefabs[i];
|
||||
CurrentCharacterIdx = i;
|
||||
CurrentCharacterController.PlayerCharacterIdentity.SynchronizeControll();
|
||||
defaultCharacterFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!defaultCharacterFlag)
|
||||
{
|
||||
//0번 캐릭터를 현재캐릭터로 설정
|
||||
if (PlayableCharacterPrefabs != null && PlayableCharacterPrefabs.Length > 0)
|
||||
{
|
||||
CurrentCharacter = PlayableCharacterPrefabs[0];
|
||||
CurrentCharacterIdx = 0;
|
||||
CurrentCharacterController.PlayerCharacterIdentity.SynchronizeControll();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//0번 캐릭터를 현재캐릭터로 설정
|
||||
if (PlayableCharacterPrefabs != null && PlayableCharacterPrefabs.Length > 0)
|
||||
{
|
||||
CurrentCharacter = PlayableCharacterPrefabs[0];
|
||||
CurrentCharacterIdx = 0;
|
||||
CurrentCharacterController.PlayerCharacterIdentity.SynchronizeControll();
|
||||
}
|
||||
}
|
||||
|
||||
InputManager.Instance.SetUIInputMap("InGameUI");
|
||||
InputManager.Instance.SetCharacterInputMap("Character");
|
||||
|
||||
//카메라 줌 매핑
|
||||
InputManager.Instance.OnMouseScrollEvent += GameManager.Instance.Camera.ZoomCamera;
|
||||
|
||||
//이동 매핑
|
||||
InputManager.Instance.OnMoveEvent += CurrentCharacterController.MoveInput;
|
||||
InputManager.Instance.OnSprintEvent += CurrentCharacterController.SprintInput;
|
||||
InputManager.Instance.OnJumpEvent += CurrentCharacterController.JumpInput;
|
||||
//InputManager.Instance.OnNormalAttackEvent;
|
||||
//InputManager.Instance.OnHeavyAttackEvent;
|
||||
|
||||
//화면 켜기
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ApplyCharacterInfo(PlayerCharacterController pcc, UserCharacter uc)
|
||||
{
|
||||
pcc.PlayerCharacterStat.MaxHp = uc.MaxHp;
|
||||
pcc.PlayerCharacterStat.MaxMp = uc.MaxMp;
|
||||
pcc.PlayerCharacterStat.Lv = uc.Lv;
|
||||
pcc.PlayerCharacterStat.StrStat = uc.StrStat;
|
||||
pcc.PlayerCharacterStat.IntStat = uc.IntStat;
|
||||
pcc.PlayerCharacterIdentity.IsDefaultControl = uc.DefaultControl;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
if(InputManager.Instance != null)
|
||||
{
|
||||
|
||||
//카메라 줌 매핑 해제
|
||||
if (GameManager.Instance != null && GameManager.Instance.Camera != null)
|
||||
{
|
||||
InputManager.Instance.OnMouseScrollEvent -= GameManager.Instance.Camera.ZoomCamera;
|
||||
}
|
||||
|
||||
|
||||
if(CurrentCharacterController != null)
|
||||
{
|
||||
//이동 매핑 해제
|
||||
InputManager.Instance.OnMoveEvent -= CurrentCharacterController.MoveInput;
|
||||
InputManager.Instance.OnSprintEvent -= CurrentCharacterController.SprintInput;
|
||||
InputManager.Instance.OnJumpEvent -= CurrentCharacterController.JumpInput;
|
||||
//InputManager.Instance.OnNormalAttackEvent;
|
||||
//InputManager.Instance.OnHeavyAttackEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/Local/LevelManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/Local/LevelManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4e261223cd434d49af1414087ba5871
|
||||
8
Assets/02_Scripts/Managers/UI.meta
Normal file
8
Assets/02_Scripts/Managers/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2ce3199cf34c8e4c90dbda71f1db34e
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/02_Scripts/Managers/UI/BaseUIManager.cs
Normal file
16
Assets/02_Scripts/Managers/UI/BaseUIManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BaseUIManager : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/BaseUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/BaseUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a8f2efec4f0f78418e3d00cd85fc18f
|
||||
43
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs
Normal file
43
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class GlobalUIManager : BaseUIManager
|
||||
{
|
||||
public static GlobalUIManager Instance;
|
||||
|
||||
[SerializeField] private Loading _sceneLoading;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance == null)
|
||||
{
|
||||
Instance = this; //만들어진 자신을 인스턴스로 설정
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject); //이미 인스턴스가 있으면 자신을 파괴
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetSceneLoadingActive(false);
|
||||
}
|
||||
|
||||
public void SetSceneLoadingActive(bool flag)
|
||||
{
|
||||
_sceneLoading.gameObject.SetActive(flag);
|
||||
}
|
||||
|
||||
public void SetSceneLoadingProgressValue(float value)
|
||||
{
|
||||
_sceneLoading.LoadingImage.fillAmount = value;
|
||||
_sceneLoading.LoadingTextMeshProUGUI.text = $"{(value * 100):F0}% 로딩 중...";
|
||||
}
|
||||
public void SetSceneLoadingProgressValue(float value,string loadingText)
|
||||
{
|
||||
_sceneLoading.LoadingImage.fillAmount = value;
|
||||
_sceneLoading.LoadingTextMeshProUGUI.text = loadingText;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/GlobalUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b66ac6fc047ff644bac21bdf5b298a9c
|
||||
16
Assets/02_Scripts/Managers/UI/InGameUIManager.cs
Normal file
16
Assets/02_Scripts/Managers/UI/InGameUIManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class InGameUIManager : BaseUIManager
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/InGameUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/InGameUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f347da8e055eeb04bbf40bbcd5d2002f
|
||||
51
Assets/02_Scripts/Managers/UI/IntroUIManager.cs
Normal file
51
Assets/02_Scripts/Managers/UI/IntroUIManager.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class IntroUIManager : MonoBehaviour
|
||||
{
|
||||
[Header("Menu Settings")]
|
||||
public List<MenuButton> MenuButtons; // 인스펙터에서 버튼들을 등록함
|
||||
|
||||
private MenuLogic _menu; // 내부적으로 로직 객체를 들고 있음
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
{
|
||||
SetMenuLogic(new MenuLogic(MenuButtons));
|
||||
|
||||
InputManager.Instance.SetUIInputMap("IntroUI");
|
||||
}
|
||||
|
||||
private void SetMenuLogic(MenuLogic menuLogic)
|
||||
{
|
||||
//혹시라도 나중에 이벤트를 재할당할 일이 있다면 반드시 기존 이벤트는 해제하고 연결해야함
|
||||
if(_menu != null)
|
||||
{
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent -= _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent -= _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent -= _menu.MenuConfirm;
|
||||
}
|
||||
|
||||
_menu = menuLogic;
|
||||
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent += _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent += _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent += _menu.MenuConfirm;
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
InputManager.Instance.OnKeyDown_UpArrowEvent -= _menu.MenuMoveUp;
|
||||
InputManager.Instance.OnKeyDown_DownArrowEvent -= _menu.MenuMoveDown;
|
||||
InputManager.Instance.OnKeyDown_EnterEvent -= _menu.MenuConfirm;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Managers/UI/IntroUIManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/UI/IntroUIManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9184a794080be324daa38d05d5f448da
|
||||
8
Assets/02_Scripts/Network.meta
Normal file
8
Assets/02_Scripts/Network.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 456bfe8f7b232c74da4a066e447525b0
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Assets/02_Scripts/Network/BypassCertificate.cs
Normal file
12
Assets/02_Scripts/Network/BypassCertificate.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Game.Network
|
||||
{
|
||||
public class BypassCertificate : CertificateHandler
|
||||
{
|
||||
protected override bool ValidateCertificate(byte[] certificateData)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Network/BypassCertificate.cs.meta
Normal file
2
Assets/02_Scripts/Network/BypassCertificate.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b01b357e7fac34649aab4a2c6c21cb52
|
||||
8
Assets/02_Scripts/Network/DTOs.meta
Normal file
8
Assets/02_Scripts/Network/DTOs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbcfa79451ef10a42be9c31385c0f6df
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
16
Assets/02_Scripts/Network/DTOs/ApiResponse.cs
Normal file
16
Assets/02_Scripts/Network/DTOs/ApiResponse.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class ApiResponse<T>
|
||||
{
|
||||
[JsonProperty("data")]
|
||||
public T data;
|
||||
|
||||
[JsonProperty("count")]
|
||||
public int count;
|
||||
|
||||
[JsonProperty("message")]
|
||||
public string message;
|
||||
|
||||
}
|
||||
2
Assets/02_Scripts/Network/DTOs/ApiResponse.cs.meta
Normal file
2
Assets/02_Scripts/Network/DTOs/ApiResponse.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb94c1cecca334c4eb4c5b7fe59a03ff
|
||||
18
Assets/02_Scripts/Network/DTOs/PlayableCharacterDTO.cs
Normal file
18
Assets/02_Scripts/Network/DTOs/PlayableCharacterDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Network.DTO
|
||||
{
|
||||
[Serializable]
|
||||
public class PlayableCharacterDTO
|
||||
{
|
||||
[JsonProperty("characterCode")]
|
||||
public string characterCode;
|
||||
|
||||
[JsonProperty("characterType")]
|
||||
public string characterType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6d03479a7bef6e4a989f51f2bfdffa1
|
||||
39
Assets/02_Scripts/Network/DTOs/UserCharacterDTO.cs
Normal file
39
Assets/02_Scripts/Network/DTOs/UserCharacterDTO.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Game.Network.DTO
|
||||
{
|
||||
[Serializable]
|
||||
public class UserCharacterDTO
|
||||
{
|
||||
[JsonProperty("userCharacterNo")]
|
||||
public int userCharacterNo;
|
||||
|
||||
[JsonProperty("userNo")]
|
||||
public int userNo;
|
||||
|
||||
[JsonProperty("characterCode")]
|
||||
public string characterCode;
|
||||
|
||||
[JsonProperty("lv")]
|
||||
public int lv;
|
||||
|
||||
[JsonProperty("strStat")]
|
||||
public int strStat;
|
||||
|
||||
[JsonProperty("intStat")]
|
||||
public int intStat;
|
||||
|
||||
[JsonProperty("maxHp")]
|
||||
public int maxHp;
|
||||
|
||||
[JsonProperty("maxMp")]
|
||||
public int maxMp;
|
||||
|
||||
[JsonProperty("defaultControl")]
|
||||
public bool defaultControl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
2
Assets/02_Scripts/Network/DTOs/UserCharacterDTO.cs.meta
Normal file
2
Assets/02_Scripts/Network/DTOs/UserCharacterDTO.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cd2049bdb6973d4babce5f871027dc7
|
||||
8
Assets/02_Scripts/Player.meta
Normal file
8
Assets/02_Scripts/Player.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1b6733c192e06f40968b5b83687efec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/Player/Camera.meta
Normal file
8
Assets/02_Scripts/Player/Camera.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7717b7d2f922a0a47b5d434199cbf8c9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
3
Assets/02_Scripts/Player/Camera/CameraMode.cs
Normal file
3
Assets/02_Scripts/Player/Camera/CameraMode.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
using UnityEngine;
|
||||
|
||||
public enum CameraMode { FreeLook, Aim }
|
||||
2
Assets/02_Scripts/Player/Camera/CameraMode.cs.meta
Normal file
2
Assets/02_Scripts/Player/Camera/CameraMode.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 352c627185dd0f644a938ceeb3f50257
|
||||
25
Assets/02_Scripts/Player/Camera/PlayerCameraRig.cs
Normal file
25
Assets/02_Scripts/Player/Camera/PlayerCameraRig.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using UnityEngine;
|
||||
using Unity.Cinemachine;
|
||||
|
||||
public class PlayerCameraRig : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private CinemachineCamera _previewCam;
|
||||
[SerializeField] private CinemachineCamera _aimCam;
|
||||
|
||||
private CinemachineCamera _currentCam;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_currentCam = _previewCam;
|
||||
}
|
||||
|
||||
public float CurrentFOV
|
||||
{
|
||||
get { return _currentCam.Lens.FieldOfView; }
|
||||
set
|
||||
{
|
||||
if(_currentCam == _previewCam)
|
||||
_currentCam.Lens.FieldOfView = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Player/Camera/PlayerCameraRig.cs.meta
Normal file
2
Assets/02_Scripts/Player/Camera/PlayerCameraRig.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c8edc71b2d7ec249bbdb4b23726bee0
|
||||
8
Assets/02_Scripts/Player/Controllers.meta
Normal file
8
Assets/02_Scripts/Player/Controllers.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48f5f91b03abc29499153c0d08c9104b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,283 @@
|
||||
using System.Threading;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerCharacterController : MonoBehaviour
|
||||
{
|
||||
private CharacterController _cController;
|
||||
private Animator _anim;
|
||||
private PlayerStateMachine _stateMachine;
|
||||
|
||||
//환경
|
||||
private float _gravityValue = Physics.gravity.y; //중력
|
||||
|
||||
//이동
|
||||
private Vector2 _moveInput; // 입력받은 이동 방향
|
||||
private Vector3 _velocityY = new Vector3(0,-2f,0); // 플레이어Y의 속도 //Y축만 물리법칙의 지배를 일부 받기 때문에 필요
|
||||
private Vector3 _moveTargetDir; // 실제 가고자하는 이동방향
|
||||
|
||||
//캐릭터 스피드
|
||||
[SerializeField] private float _spdCoefficient = 4f; //스피드 계수
|
||||
[SerializeField] private float _acceleration = 4f; // 가속도
|
||||
[SerializeField] private float _deceleration = 20f; // 감속도
|
||||
private float _walkSpdRatio = 0.3f; // 걷기 속도 블렌드 비율 //여기를 수정하면 에디터의 블렌드도 수정해야함
|
||||
private float _runSpdRatio = 1f; // 달리기 속도 블렌드 비율 //여기를 수정하면 에디터의 블렌드도 수정해야함
|
||||
private float _currentSpd; //현재 스피드
|
||||
|
||||
//점프
|
||||
[SerializeField] private float _jumpPower = 1.5f; //점프 힘
|
||||
private float _jumpReadyCool = 0.8f; //점프 쿨타임
|
||||
private float _jumpReadyCoolTimer = 0f; //점프 쿨타이머
|
||||
|
||||
//대쉬
|
||||
[SerializeField] private AnimationCurve _dodgeCurve; // 변속용 커브
|
||||
[SerializeField] private float _dodgeDistance = 5f; // 총 대쉬 거리
|
||||
[SerializeField] private float _dodgeDuration = 0.5f; // 대쉬 지속 시간 (무적시간)
|
||||
private float _dodgeTimer = 0f; // 대쉬 진행 측정용
|
||||
private Vector3 _dodgeDir; // 대쉬 시작 시점의 방향 고정
|
||||
|
||||
//카메라 전환
|
||||
[SerializeField] private PlayerCameraRig _playerCameraRig; //카메라 집합체
|
||||
private CameraMode _cameraMode = CameraMode.FreeLook; //카메라 모드
|
||||
private CancellationTokenSource _cameraDelayChangeCts; //지연전환 취소 토큰
|
||||
|
||||
//캐릭터 관련
|
||||
public CharacterIdentity PlayerCharacterIdentity { get; set; }
|
||||
public PlayerStat PlayerCharacterStat{ get; set; }
|
||||
|
||||
//무기
|
||||
//[SerializeField] private Weapon _weapon;
|
||||
|
||||
/*
|
||||
* 웨폰 모듈로 따로 빼볼것
|
||||
*
|
||||
//차지공격
|
||||
//private float _chargePowerAdded = 0f; //차지 기본값에 더해줄 힘 //weapon 모듈로 뺄것
|
||||
//private float _chargePowerFirst = 20f; //차지 기본값 (바로 시전해도 값이 있어야 되기 때문) //weapon 모듈로 뺄것
|
||||
//private float _chargePowerDelta = 0.2f; //차지할때 힘이 더해질 단위시간 //weapon 모듈로 뺄것
|
||||
private event Action _chargeAttackCallback; //차지공격시 실행될 함수
|
||||
|
||||
//private AimingModule _aimingModule; //이건 weapon 모듈로 빼볼것
|
||||
|
||||
//private float _bowShootCoolTime = 0.5f; // weapon(Bow)로 뺄것
|
||||
//private float _bowShootCoolTimer = 0f; // weapon(Bow)로 뺄것
|
||||
|
||||
//[SerializeField] private LineRenderer _arrowTraceRenderer; // weapon(Bow)로 뺄것
|
||||
//private int _arrowTraceResolution = 30; // 화살 궤적 선을 구성하는 점의 개수 (정밀도) // weapon(Bow)로 뺄것
|
||||
//private float _arrowTraceStepTime = 0.1f; // 화살 궤적 점 사이의 시간 간격 // weapon(Bow)로 뺄것
|
||||
*/
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_cController = GetComponent<CharacterController>();
|
||||
_anim = GetComponent<Animator>();
|
||||
_stateMachine = GetComponent<PlayerStateMachine>();
|
||||
PlayerCharacterIdentity = GetComponent<CharacterIdentity>();
|
||||
PlayerCharacterStat = GetComponent<PlayerStat>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
//캐릭터 컨트롤러는 FixedUpdate보다 Update에서 하는게 권장됨
|
||||
Movement();
|
||||
CheckGround();
|
||||
WorkGravity();
|
||||
ApplyVelocity();
|
||||
|
||||
//PlayerDebug();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PlayerDebug()
|
||||
{
|
||||
Debug.Log($"isGrounded : {_stateMachine.IsGrounded}");
|
||||
}
|
||||
|
||||
#region 체크
|
||||
private void CheckGround()
|
||||
{
|
||||
_stateMachine.IsGrounded = _cController.isGrounded;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 중력
|
||||
private void WorkGravity()
|
||||
{
|
||||
if (_stateMachine.IsGrounded && _velocityY.y < 0)
|
||||
{
|
||||
_velocityY.y = -2f;
|
||||
}
|
||||
|
||||
_velocityY.y += _gravityValue * Time.deltaTime;
|
||||
_anim.SetFloat("velocityY", _velocityY.y);
|
||||
|
||||
// 상태 자동 전환 로직
|
||||
if (!_stateMachine.IsGrounded && _stateMachine.CurrentState != PlayerState.Jump && _stateMachine.CurrentState != PlayerState.Attack && _stateMachine.CurrentState != PlayerState.Charge)
|
||||
{
|
||||
_stateMachine.ChangeState(PlayerState.Fall);
|
||||
}
|
||||
else if (_stateMachine.IsGrounded && _stateMachine.CurrentState == PlayerState.Fall)
|
||||
{
|
||||
_stateMachine.ChangeState(PlayerState.Idle);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 이동
|
||||
public void MoveInput(Vector2 moveInput)
|
||||
{
|
||||
if (_stateMachine.CanMove())
|
||||
{
|
||||
_moveInput = moveInput;
|
||||
}
|
||||
}
|
||||
public void SprintInput(InputState inputState)
|
||||
{
|
||||
if(inputState == InputState.Performing)
|
||||
{
|
||||
_stateMachine.IsRunInputPressed = true;
|
||||
}
|
||||
else if(inputState == InputState.Canceled)
|
||||
{
|
||||
_stateMachine.IsRunInputPressed = false;
|
||||
}
|
||||
}
|
||||
private void Movement()
|
||||
{
|
||||
//구르기중일때 전용 로직
|
||||
if (_stateMachine.CurrentState == PlayerState.Dodge)
|
||||
{
|
||||
_dodgeTimer = _dodgeDuration;
|
||||
|
||||
float normalizedTime = (_dodgeDuration - _dodgeTimer) / _dodgeDuration; // 0 ~ 1 사이의 진행률
|
||||
|
||||
if (normalizedTime >= 1.0f)
|
||||
{
|
||||
// 구르기 종료 -> 원래상태로 복귀 로직
|
||||
//_stateMachine.ChangeState(PlayerState.Idle);
|
||||
//_currentSpd = 0f;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 커브에서 현재 시점의 '속도 배율'을 가져옴
|
||||
// 그래프의 전체 넓이는 1
|
||||
float curveValue = _dodgeCurve.Evaluate(normalizedTime);
|
||||
|
||||
// 최종 속도 = (전체 거리 / 시간) * 커브 배율 ??
|
||||
_currentSpd = (_dodgeDistance / _dodgeDuration) * curveValue;
|
||||
_moveTargetDir = _dodgeDir * _currentSpd;
|
||||
|
||||
// 구르기 중엔 즉시 회전 (선택 사항)
|
||||
transform.rotation = Quaternion.LookRotation(_dodgeDir);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
float targetSpd = 0;
|
||||
|
||||
if (_moveInput.sqrMagnitude < Mathf.Epsilon) // 이동이 없는상태 - 거의 0
|
||||
{
|
||||
targetSpd = 0f;
|
||||
// 완전히 멈추기 전까지는 이동 상태를 유지하다가 아주 느려지면 Idle 전환
|
||||
if (_currentSpd < 0.05f) _stateMachine.ChangeState(PlayerState.Idle);
|
||||
|
||||
|
||||
//가속도 안쓸시
|
||||
//_currentSpd = 0;
|
||||
//_stateMachine.ChangeState(PlayerState.Idle);
|
||||
}
|
||||
else //이동이 없지 않음 = 이동이 있다
|
||||
{
|
||||
// 런키를 누른 상태면 뛰는 스피드, 아니면 걷는 스피드 적용
|
||||
_stateMachine.ChangeState(_stateMachine.IsRunInputPressed ? PlayerState.Run : PlayerState.Walk);
|
||||
targetSpd = _stateMachine.IsRunInputPressed ? _runSpdRatio * _spdCoefficient : _walkSpdRatio * _spdCoefficient;
|
||||
|
||||
//가속도 안쓸시
|
||||
//_stateMachine.ChangeState(_stateMachine.IsRunInputPressed ? PlayerState.Run : PlayerState.Walk);
|
||||
//_currentSpd = _stateMachine.IsRunInputPressed ? _runSpdRatio * _spdCoefficient : _walkSpdRatio * _spdCoefficient;
|
||||
}
|
||||
|
||||
|
||||
// _currentSpd가 targetSpd로 서서히 접근
|
||||
float accelWeight = _stateMachine.CurrentState == PlayerState.Run ? 2 : 1; //런일때 가속도 가중치
|
||||
float currentStepSpeed = (targetSpd > _currentSpd) ? _acceleration : _deceleration;
|
||||
_currentSpd = Mathf.MoveTowards(_currentSpd, targetSpd, currentStepSpeed * accelWeight * Time.deltaTime);
|
||||
|
||||
_anim.SetFloat("speedRatio", _currentSpd / _spdCoefficient);
|
||||
|
||||
Vector3 camForward = Camera.main.transform.forward; //메인카메라의 로컬기준 앞쪽방향
|
||||
camForward.y = 0; //높이를 무시하기 위해 0으로
|
||||
camForward.Normalize();
|
||||
|
||||
Vector3 camRight = Camera.main.transform.right; //메인카메라의 로컬기준 x축, 오른쪽 방향
|
||||
camRight.y = 0; //높이를 무시하기 위해 0으로
|
||||
camRight.Normalize();
|
||||
|
||||
Vector3 moveDir = new Vector3(_moveInput.x, 0, _moveInput.y);
|
||||
|
||||
_moveTargetDir = (moveDir.x * camRight + moveDir.z * camForward) * _currentSpd;//오른쪽을 눌렀다면 camRight 방향으로 그만큼, 위쪽을 눌렀다면 camForward방향으로 그만큼 가라
|
||||
|
||||
RotationByMove();
|
||||
}
|
||||
private void RotationByMove()
|
||||
{
|
||||
if(_moveTargetDir.magnitude > Mathf.Epsilon)
|
||||
{
|
||||
Quaternion lookTarget = Quaternion.LookRotation(_moveTargetDir); // 방향 벡터를 쿼터니언 회전값으로 전환
|
||||
transform.rotation = Quaternion.Slerp(transform.rotation, lookTarget, Time.deltaTime * 10);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 속도적용
|
||||
private void ApplyVelocity()
|
||||
{
|
||||
Vector3 finalVector = new Vector3(_moveTargetDir.x, _velocityY.y, _moveTargetDir.z);
|
||||
_cController.Move(finalVector * Time.deltaTime); // xz 이동벡터를 적용
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 대시(구르기,횡이동등)
|
||||
public void DodgeInput(InputState inputState)
|
||||
{
|
||||
// 구르기 가능한 상태일 때만
|
||||
if (inputState == InputState.Started && _stateMachine.CanDodge())
|
||||
{
|
||||
Vector3 camForward = Camera.main.transform.forward;
|
||||
camForward.y = 0;
|
||||
camForward.Normalize();
|
||||
|
||||
// 입력이 없으면 카메라가 보는 앞방향, 있으면 입력 방향
|
||||
_dodgeDir = _moveInput.sqrMagnitude > Mathf.Epsilon ? _moveTargetDir.normalized : camForward;
|
||||
|
||||
// 상태 전환 및 타이머 초기화
|
||||
_stateMachine.ChangeState(PlayerState.Dodge);
|
||||
_dodgeTimer = 0f;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 점프
|
||||
public void JumpInput(InputState inputState)
|
||||
{
|
||||
if(_stateMachine.CanJump())
|
||||
{
|
||||
if (inputState == InputState.Started && _stateMachine.IsGrounded && _stateMachine.CurrentState != PlayerState.Jump && _jumpReadyCoolTimer <= 0f)
|
||||
{
|
||||
_anim.SetTrigger("jumpTrigger");
|
||||
_stateMachine.ChangeState(PlayerState.Jump);
|
||||
_jumpReadyCoolTimer = _jumpReadyCool;
|
||||
_ = Util.RunDelayed(0.7f, JumpAction, default);
|
||||
}
|
||||
}
|
||||
}
|
||||
private void JumpAction()
|
||||
{
|
||||
_velocityY.y = Mathf.Sqrt(_jumpPower * -2f * _gravityValue);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 373d962328bfba94bba93617ed5a4830
|
||||
8
Assets/02_Scripts/Player/FSM.meta
Normal file
8
Assets/02_Scripts/Player/FSM.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ada7592d5969c5d41b789934b619e538
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1
Assets/02_Scripts/Player/FSM/PlayerState.cs
Normal file
1
Assets/02_Scripts/Player/FSM/PlayerState.cs
Normal file
@@ -0,0 +1 @@
|
||||
public enum PlayerState { Idle, Walk, Run, Dodge, Jump, Fall, Attack, Charge, Hit, Dead }
|
||||
2
Assets/02_Scripts/Player/FSM/PlayerState.cs.meta
Normal file
2
Assets/02_Scripts/Player/FSM/PlayerState.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44cc9d20cdc683d429b6fb86a3ee88c0
|
||||
75
Assets/02_Scripts/Player/FSM/PlayerStateMachine.cs
Normal file
75
Assets/02_Scripts/Player/FSM/PlayerStateMachine.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerStateMachine : MonoBehaviour
|
||||
{
|
||||
private Animator _anim;
|
||||
|
||||
public PlayerState CurrentState { get; private set; } = PlayerState.Idle;
|
||||
public Action<PlayerState> OnStateChanged; // 상태가 변했을 때 다른 컴포넌트들이 알 수 있도록 이벤트 제공 (함수 포인터 활용)
|
||||
|
||||
public bool IsGrounded { get; set; } //상태 머신이기 때문에 계산은 여기서 안함 (플레이어가 갱신할 수 있도록 set 허용)
|
||||
public bool IsRunInputPressed { get; set; } //달리기키가 눌린 상태인가
|
||||
public bool IsPossibleCharge { get; set; } //현재 차지 가능한 상태인가
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_anim = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void ChangeState(PlayerState newState)
|
||||
{
|
||||
if (CurrentState == newState) return;
|
||||
|
||||
// 상태 전환 규칙 (예: 죽었는데 공격 상태로 갈 수 없음)
|
||||
if (CurrentState == PlayerState.Dead) return;
|
||||
|
||||
CurrentState = newState;
|
||||
_anim.SetInteger("playerState", (int)newState);
|
||||
|
||||
OnStateChanged?.Invoke(newState);
|
||||
|
||||
//Debug.Log($"State Switched to: {newState}");
|
||||
}
|
||||
|
||||
#region 상태확인용 헬퍼함수들
|
||||
//지상 이동이 가능한가?
|
||||
public bool CanMove() => IsGrounded && (CurrentState == PlayerState.Idle || CurrentState == PlayerState.Walk || CurrentState == PlayerState.Run);
|
||||
//점프가 가능한 상태인가?
|
||||
public bool CanJump() => IsGrounded && (CurrentState == PlayerState.Idle || CurrentState == PlayerState.Walk || CurrentState == PlayerState.Run);
|
||||
//대쉬가 가능한 상태인가?
|
||||
public bool CanDodge()
|
||||
{
|
||||
// 이미 구르는중
|
||||
if (CurrentState == PlayerState.Dodge) return false;
|
||||
|
||||
// 공중대쉬 제한
|
||||
// if (!IsGrounded) return false;
|
||||
|
||||
// 피격 상태이거나 죽었을 때 안 되게
|
||||
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead) return false;
|
||||
|
||||
// 스태미나 시스템이 있다면 체크
|
||||
// if (CurrentStamina < DodgeCost) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
//공중에서 조작 가능한 상태인가?
|
||||
public bool CanControlInAir() => !IsGrounded && (CurrentState == PlayerState.Jump || CurrentState == PlayerState.Fall);
|
||||
//공격이 가능한 상태인가?
|
||||
public bool CanAttack()
|
||||
{
|
||||
//이미 공격 중이거나 차징 중이면 공격 불가 (연속기가 있다면 바뀔수 있음)
|
||||
if (CurrentState == PlayerState.Attack || CurrentState == PlayerState.Charge)
|
||||
return false;
|
||||
|
||||
//피격(Hit) 중이거나 죽었다면(Dead) 공격 불가
|
||||
if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead)
|
||||
return false;
|
||||
|
||||
// (Idle, Walk, Run, Jump, Fall 상태에서 공격 가능)
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
2
Assets/02_Scripts/Player/FSM/PlayerStateMachine.cs.meta
Normal file
2
Assets/02_Scripts/Player/FSM/PlayerStateMachine.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cecb8fbaaff0144ab59c73f78f1ecff
|
||||
8
Assets/02_Scripts/Player/Status.meta
Normal file
8
Assets/02_Scripts/Player/Status.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 697788ed80d084a4dbfe28173f750b6b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/02_Scripts/Player/Status/PlayerHealth.cs
Normal file
18
Assets/02_Scripts/Player/Status/PlayerHealth.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerHealth : Health
|
||||
{
|
||||
private PlayerStat _pstat;
|
||||
public int currentHp;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_pstat = GetComponent<PlayerStat>();
|
||||
//currentHp = _pstat.MaxHp; // 스태틱 데이터를 가져와 초기화
|
||||
}
|
||||
|
||||
public void TakeDamage(int damage)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/Player/Status/PlayerHealth.cs.meta
Normal file
2
Assets/02_Scripts/Player/Status/PlayerHealth.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab0e8069f023be141afde6c2897d148e
|
||||
10
Assets/02_Scripts/Player/Status/PlayerStat.cs
Normal file
10
Assets/02_Scripts/Player/Status/PlayerStat.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
public class PlayerStat : Stat
|
||||
{
|
||||
public int StrStat;
|
||||
public int IntStat;
|
||||
|
||||
public int AttackPower => StrStat * 2;
|
||||
}
|
||||
2
Assets/02_Scripts/Player/Status/PlayerStat.cs.meta
Normal file
2
Assets/02_Scripts/Player/Status/PlayerStat.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 988583c34b5280e42a4ea5b50a93e1f9
|
||||
8
Assets/02_Scripts/Player/Weapon.meta
Normal file
8
Assets/02_Scripts/Player/Weapon.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f07df026e70bb85439cf32701da085be
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6
Assets/02_Scripts/Player/Weapon/Weapon.cs
Normal file
6
Assets/02_Scripts/Player/Weapon/Weapon.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Weapon : MonoBehaviour
|
||||
{
|
||||
private WeaponType weaponType;
|
||||
}
|
||||
2
Assets/02_Scripts/Player/Weapon/Weapon.cs.meta
Normal file
2
Assets/02_Scripts/Player/Weapon/Weapon.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef0908b448dc79a4cb143afdd40525d1
|
||||
3
Assets/02_Scripts/Player/Weapon/WeaponType.cs
Normal file
3
Assets/02_Scripts/Player/Weapon/WeaponType.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
using UnityEngine;
|
||||
|
||||
public enum WeaponType { Sword, Bow}
|
||||
2
Assets/02_Scripts/Player/Weapon/WeaponType.cs.meta
Normal file
2
Assets/02_Scripts/Player/Weapon/WeaponType.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a296b618cf084c49a76eaec005fc0ff
|
||||
8
Assets/02_Scripts/UI.meta
Normal file
8
Assets/02_Scripts/UI.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b689422a15bd5af4f86459173a107745
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/02_Scripts/UI/Loading.cs
Normal file
11
Assets/02_Scripts/UI/Loading.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class Loading : MonoBehaviour
|
||||
{
|
||||
public Image LoadingImage;
|
||||
public Image BackgroundImage;
|
||||
public TextMeshProUGUI LoadingTextMeshProUGUI;
|
||||
public bool BackgroundOnOffFlag = true;
|
||||
}
|
||||
2
Assets/02_Scripts/UI/Loading.cs.meta
Normal file
2
Assets/02_Scripts/UI/Loading.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5ee5f227e46d65c45b9f82c5b39e4874
|
||||
8
Assets/02_Scripts/UI/Menu.meta
Normal file
8
Assets/02_Scripts/UI/Menu.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc45a5b2b346a7b45ad167427f4f7d7b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/02_Scripts/UI/Menu/MenuButton.cs
Normal file
11
Assets/02_Scripts/UI/Menu/MenuButton.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MenuButton : MonoBehaviour
|
||||
{
|
||||
public string Name;
|
||||
public Image MenuImage;
|
||||
public GameObject GlowEffect;
|
||||
public UnityEvent ConfirmAction; //유니티가 제공해주는 event
|
||||
}
|
||||
2
Assets/02_Scripts/UI/Menu/MenuButton.cs.meta
Normal file
2
Assets/02_Scripts/UI/Menu/MenuButton.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a2487a13f17eba4bacda6db519183f1
|
||||
44
Assets/02_Scripts/UI/Menu/MenuLogic.cs
Normal file
44
Assets/02_Scripts/UI/Menu/MenuLogic.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class MenuLogic
|
||||
{
|
||||
private List<MenuButton> buttons;
|
||||
private int currentIndex = 0;
|
||||
|
||||
public MenuLogic(List<MenuButton> buttonList)
|
||||
{
|
||||
buttons = buttonList;
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
private void RefreshUI()
|
||||
{
|
||||
for (int i = 0; i < buttons.Count; i++)
|
||||
{
|
||||
// 현재 인덱스만 백그라운드 활성화!
|
||||
buttons[i].GlowEffect.SetActive(i == currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public void MenuMoveUp()
|
||||
{
|
||||
MenuMove(1);
|
||||
}
|
||||
|
||||
public void MenuMoveDown()
|
||||
{
|
||||
MenuMove(-1);
|
||||
}
|
||||
|
||||
public void MenuMove(int direction)
|
||||
{
|
||||
currentIndex = (currentIndex + direction + buttons.Count) % buttons.Count;
|
||||
RefreshUI();
|
||||
}
|
||||
|
||||
public void MenuConfirm()
|
||||
{
|
||||
buttons[currentIndex].ConfirmAction.Invoke();
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/UI/Menu/MenuLogic.cs.meta
Normal file
2
Assets/02_Scripts/UI/Menu/MenuLogic.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a9d2da91d67ef747a7767f987c7c105
|
||||
8
Assets/02_Scripts/_Shared.meta
Normal file
8
Assets/02_Scripts/_Shared.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 797d5a2e3856203478a571971b08cfb3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/02_Scripts/_Shared/Combat.meta
Normal file
8
Assets/02_Scripts/_Shared/Combat.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: caa4d29e142b7744bbe9e57a392c44c8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/02_Scripts/_Shared/Combat/CombatSystem.cs
Normal file
28
Assets/02_Scripts/_Shared/Combat/CombatSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class CombatSystem : MonoBehaviour
|
||||
{
|
||||
private PlayerStateMachine _playerStateMachine;
|
||||
private Animator _animator;
|
||||
private float _chargeTimer;
|
||||
|
||||
[SerializeField] private Weapon _currentWeapon; // 현재 장착된 무기
|
||||
|
||||
void Awake()
|
||||
{
|
||||
_playerStateMachine = GetComponent<PlayerStateMachine>();
|
||||
_animator = GetComponent<Animator>();
|
||||
}
|
||||
|
||||
public void OnAttackInput(InputAction.CallbackContext context)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (_playerStateMachine.CurrentState == PlayerState.Charge)
|
||||
_chargeTimer += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
2
Assets/02_Scripts/_Shared/Combat/CombatSystem.cs.meta
Normal file
2
Assets/02_Scripts/_Shared/Combat/CombatSystem.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79c1089a2d7d68f46a2f31d0593a19e0
|
||||
8
Assets/02_Scripts/_Shared/Status.meta
Normal file
8
Assets/02_Scripts/_Shared/Status.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a47b7237c964f64ebde73011ce9d815
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/02_Scripts/_Shared/Status/CharacterIdentity.cs
Normal file
46
Assets/02_Scripts/_Shared/Status/CharacterIdentity.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
|
||||
public enum CharacterType { Playable, NPC, Enemy, None }
|
||||
|
||||
public class CharacterIdentity : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private string _characterCode;
|
||||
public string CharacterCode { get { return _characterCode; } private set { _characterCode = value; } }
|
||||
public bool IsControlling { get; private set; } = false;
|
||||
public bool IsDefaultControl { get; set;}
|
||||
|
||||
public CharacterType GetCharacterType()
|
||||
{
|
||||
string CharacterTypeStr = null;
|
||||
|
||||
if (DataManager.Instance.PlayableCharacterData.TryGetValue(_characterCode, out var c1)) CharacterTypeStr = c1.CharacterType;
|
||||
if (DataManager.Instance.EnemyCharacterData.TryGetValue(_characterCode, out var c2)) CharacterTypeStr = c2.CharacterType;
|
||||
if (DataManager.Instance.NpcCharacterData.TryGetValue(_characterCode, out var c3)) CharacterTypeStr = c3.CharacterType;
|
||||
|
||||
if (CharacterTypeStr == "PLAYABLE")
|
||||
return CharacterType.Playable;
|
||||
|
||||
if (CharacterTypeStr == "ENEMY")
|
||||
return CharacterType.Enemy;
|
||||
|
||||
if (CharacterTypeStr == "NPC")
|
||||
return CharacterType.NPC;
|
||||
|
||||
return CharacterType.None;
|
||||
}
|
||||
|
||||
public void SynchronizeControll()
|
||||
{
|
||||
if (GetCharacterType() != CharacterType.Playable) return;
|
||||
|
||||
// 정렬없이 씬의 모든 PlayerCharacterController 검색
|
||||
PlayerCharacterController[] pccs = Object.FindObjectsByType<PlayerCharacterController>(FindObjectsSortMode.None);
|
||||
|
||||
//모든 컨트롤을 끄고 자기 자신만 킴으로써 IsControlling은 한개체만 true임
|
||||
foreach (PlayerCharacterController pcc in pccs)
|
||||
{
|
||||
pcc.gameObject.GetComponent<CharacterIdentity>().IsControlling = false;
|
||||
}
|
||||
this.IsControlling = true;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user