[Network] 스킬 시스템 네트워크 동기화 및 로그 정리
- 스킬 실행 RequestSkillExecutionRpc (Client -> Server) - 스킬 전파 BroadcastSkillExecutionRpc (Server -> All Clients) - 서버에서 마나/쿨타임 검증 - NormalizeTime 디버그 로그 제거
This commit is contained in:
@@ -261,6 +261,18 @@ PrefabInstance:
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 80
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
@@ -295,7 +307,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -420
|
||||
value: -430
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: 99f359b6678b0064dbd20508482d6d64, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
@@ -406,6 +418,18 @@ PrefabInstance:
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 80
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: d8795051068c4f84e84c227a6618e587, type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: d8795051068c4f84e84c227a6618e587, type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: d8795051068c4f84e84c227a6618e587, type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1384280946776679044, guid: d8795051068c4f84e84c227a6618e587, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
|
||||
@@ -97,26 +97,73 @@ namespace Colosseum.Player
|
||||
return;
|
||||
}
|
||||
|
||||
// 로컬 체크 (빠른 피드백용)
|
||||
if (skillController.IsExecutingSkill)
|
||||
{
|
||||
Debug.Log($"Already executing skill");
|
||||
return;
|
||||
}
|
||||
|
||||
if (skillController.IsOnCooldown(skill))
|
||||
{
|
||||
Debug.Log($"Skill {skill.SkillName} is on cooldown");
|
||||
return;
|
||||
}
|
||||
|
||||
// 마나 비용 체크
|
||||
if (networkController != null && networkController.Mana < skill.ManaCost)
|
||||
{
|
||||
Debug.Log($"Not enough mana for skill: {skill.SkillName} (Required: {skill.ManaCost}, Current: {networkController.Mana})");
|
||||
Debug.Log($"Not enough mana for skill: {skill.SkillName}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 논타겟: 타겟 없이 스킬 시전
|
||||
bool success = skillController.ExecuteSkill(skill);
|
||||
if (!success)
|
||||
{
|
||||
Debug.Log($"Cannot execute skill: {skill.SkillName}");
|
||||
return;
|
||||
}
|
||||
// 서버에 스킬 실행 요청
|
||||
RequestSkillExecutionRpc(slotIndex);
|
||||
}
|
||||
|
||||
// 스킬 성공 시 마나 소모
|
||||
/// <summary>
|
||||
/// 서버에 스킬 실행 요청
|
||||
/// </summary>
|
||||
[Rpc(SendTo.Server)]
|
||||
private void RequestSkillExecutionRpc(int slotIndex)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return;
|
||||
|
||||
SkillData skill = skillSlots[slotIndex];
|
||||
if (skill == null) return;
|
||||
|
||||
// 서버에서 다시 검증
|
||||
if (skillController.IsExecutingSkill || skillController.IsOnCooldown(skill))
|
||||
return;
|
||||
|
||||
if (networkController != null && networkController.Mana < skill.ManaCost)
|
||||
return;
|
||||
|
||||
// 마나 소모
|
||||
if (networkController != null && skill.ManaCost > 0)
|
||||
{
|
||||
networkController.UseManaRpc(skill.ManaCost);
|
||||
}
|
||||
|
||||
// 모든 클라이언트에 스킬 실행 전파
|
||||
BroadcastSkillExecutionRpc(slotIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 모든 클라이언트에 스킬 실행 전파
|
||||
/// </summary>
|
||||
[Rpc(SendTo.ClientsAndHost)]
|
||||
private void BroadcastSkillExecutionRpc(int slotIndex)
|
||||
{
|
||||
if (slotIndex < 0 || slotIndex >= skillSlots.Length)
|
||||
return;
|
||||
|
||||
SkillData skill = skillSlots[slotIndex];
|
||||
if (skill == null) return;
|
||||
|
||||
// 모든 클라이언트에서 스킬 실행 (애니메이션 포함)
|
||||
skillController.ExecuteSkill(skill);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -61,11 +61,6 @@ namespace Colosseum.Skills
|
||||
|
||||
var stateInfo = animator.GetCurrentAnimatorStateInfo(0);
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"[Skill] State: {stateInfo.shortNameHash}, NormalizedTime: {stateInfo.normalizedTime:F2}, IsSkill: {stateInfo.IsName(SKILL_STATE_NAME)}");
|
||||
}
|
||||
|
||||
// EndAnimation 종료 감지
|
||||
if (waitingForEndAnimation)
|
||||
{
|
||||
|
||||
36
Assets/UserChoices.choices
Normal file
36
Assets/UserChoices.choices
Normal file
@@ -0,0 +1,36 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &1
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 53
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 18cde282a8d045bf9d245fdcfaa7271b, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Unity.Multiplayer.Center.Editor::Unity.Multiplayer.Center.Questionnaire.UserChoicesObject
|
||||
QuestionnaireVersion: 1.3
|
||||
UserAnswers:
|
||||
Answers:
|
||||
- QuestionId: Pace
|
||||
Answers:
|
||||
- Fast
|
||||
- QuestionId: Cheating
|
||||
Answers:
|
||||
- CheatingImportant
|
||||
- QuestionId: CostSensitivity
|
||||
Answers:
|
||||
- BestExperience
|
||||
- QuestionId: NetcodeArchitecture
|
||||
Answers:
|
||||
- ClientServer
|
||||
- QuestionId: PlayerCount
|
||||
Answers:
|
||||
- 4
|
||||
Preset: 2
|
||||
SelectedSolutions:
|
||||
SelectedHostingModel: 2
|
||||
SelectedNetcodeSolution: 1
|
||||
7
Assets/UserChoices.choices.meta
Normal file
7
Assets/UserChoices.choices.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 291abe421e975b24d9468acf16de7b2e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user