Merge branch 'dev' of https://github.com/2aurore/Gameton-06 into dev
This commit is contained in:
@@ -66,8 +66,7 @@ AnimatorState:
|
|||||||
m_Name: Attack
|
m_Name: Attack
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions:
|
m_Transitions: []
|
||||||
- {fileID: -262704214683766074}
|
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
m_IKOnFeet: 0
|
m_IKOnFeet: 0
|
||||||
@@ -100,32 +99,10 @@ AnimatorStateTransition:
|
|||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 0
|
m_IsExit: 0
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.75
|
m_ExitTime: 0.75
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 0
|
||||||
m_HasFixedDuration: 1
|
|
||||||
m_InterruptionSource: 0
|
|
||||||
m_OrderedInterruption: 1
|
|
||||||
m_CanTransitionToSelf: 1
|
|
||||||
--- !u!1101 &-262704214683766074
|
|
||||||
AnimatorStateTransition:
|
|
||||||
m_ObjectHideFlags: 1
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_Name:
|
|
||||||
m_Conditions: []
|
|
||||||
m_DstStateMachine: {fileID: 0}
|
|
||||||
m_DstState: {fileID: -6701309803678357875}
|
|
||||||
m_Solo: 0
|
|
||||||
m_Mute: 0
|
|
||||||
m_IsExit: 0
|
|
||||||
serializedVersion: 3
|
|
||||||
m_TransitionDuration: 0.25
|
|
||||||
m_TransitionOffset: 0
|
|
||||||
m_ExitTime: 0.75
|
|
||||||
m_HasExitTime: 1
|
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
@@ -208,10 +185,10 @@ AnimatorStateTransition:
|
|||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 0
|
m_IsExit: 0
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.5
|
m_ExitTime: 0.5
|
||||||
m_HasExitTime: 1
|
m_HasExitTime: 0
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
@@ -236,7 +213,7 @@ AnimatorStateTransition:
|
|||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0.25
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
m_ExitTime: 0.75
|
m_ExitTime: 0.75
|
||||||
m_HasExitTime: 0
|
m_HasExitTime: 1
|
||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ AnimationClip:
|
|||||||
m_Level: 0
|
m_Level: 0
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_HasAdditiveReferencePose: 0
|
m_HasAdditiveReferencePose: 0
|
||||||
m_LoopTime: 0
|
m_LoopTime: 1
|
||||||
m_LoopBlend: 0
|
m_LoopBlend: 0
|
||||||
m_LoopBlendOrientation: 0
|
m_LoopBlendOrientation: 0
|
||||||
m_LoopBlendPositionY: 0
|
m_LoopBlendPositionY: 0
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Assets.PixelFantasy.PixelMonsters.Common.Scripts;
|
||||||
using Unity.VisualScripting;
|
using Unity.VisualScripting;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using DamageCalculator = TON.DamageCalculator;
|
using DamageCalculator = TON.DamageCalculator;
|
||||||
@@ -17,7 +19,6 @@ namespace TON
|
|||||||
// public string name; // 몬스터 명 or 프리팹 명
|
// public string name; // 몬스터 명 or 프리팹 명
|
||||||
public string monsterType; // 몬스터 타입 ex : melee, ranged
|
public string monsterType; // 몬스터 타입 ex : melee, ranged
|
||||||
|
|
||||||
|
|
||||||
// public int damage; // 공격력
|
// public int damage; // 공격력
|
||||||
public float speed = 2; // 이동속도
|
public float speed = 2; // 이동속도
|
||||||
|
|
||||||
@@ -45,9 +46,30 @@ namespace TON
|
|||||||
|
|
||||||
public float defencePower;
|
public float defencePower;
|
||||||
|
|
||||||
|
public Dictionary<string, Monster> dicMonster = new Dictionary<string, Monster>(); // 초기화
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class Monster
|
||||||
|
{
|
||||||
|
public int id;
|
||||||
|
public string name;
|
||||||
|
public int level;
|
||||||
|
public int hp;
|
||||||
|
public int attackPower;
|
||||||
|
public int defencePoser;
|
||||||
|
}
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
ReadCSV();
|
||||||
|
|
||||||
|
// dicMonster 사용 예시
|
||||||
|
if (dicMonster.ContainsKey("1")) // 키 존재 확인
|
||||||
|
{
|
||||||
|
Debug.Log(dicMonster["1"].name);
|
||||||
|
}
|
||||||
|
|
||||||
_currentTime = Time.realtimeSinceStartup;
|
_currentTime = Time.realtimeSinceStartup;
|
||||||
|
|
||||||
_animator = GetComponent<Animator>();
|
_animator = GetComponent<Animator>();
|
||||||
@@ -59,15 +81,54 @@ namespace TON
|
|||||||
|
|
||||||
// TODO: 몬스터 방어력 임시값
|
// TODO: 몬스터 방어력 임시값
|
||||||
defencePower = 10f;
|
defencePower = 10f;
|
||||||
|
}
|
||||||
|
|
||||||
// // 몬스터 데이터 로드
|
private void ReadCSV()
|
||||||
// MonsterData monsterData = MonsterDataManager.Instance.monsterDataDict[monsterID];
|
{
|
||||||
//
|
TextAsset csvFile = Resources.Load<TextAsset>("Monster");
|
||||||
// // 몬스터 데이터 적용
|
|
||||||
// Debug.Log("몬스터 이름: " + monsterData.name);
|
if (csvFile == null)
|
||||||
// Debug.Log("공격력: " + monsterData.attackPower);
|
{
|
||||||
// Debug.Log("체력: " + monsterData.health);
|
Debug.LogError("CSV 파일 로드 실패: Monster");
|
||||||
// Debug.Log("속도: " + monsterData.speed);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringReader reader = new StringReader(csvFile.text);
|
||||||
|
string line;
|
||||||
|
bool isFirstLine = true; // 첫 번째 줄은 헤더로 건너뛰기
|
||||||
|
|
||||||
|
while ((line = reader.ReadLine()) != null)
|
||||||
|
{
|
||||||
|
if (isFirstLine)
|
||||||
|
{
|
||||||
|
isFirstLine = false;
|
||||||
|
continue; // 헤더 건너뛰기
|
||||||
|
}
|
||||||
|
|
||||||
|
var splitData = line.Split(',');
|
||||||
|
|
||||||
|
Monster monster = new Monster();
|
||||||
|
|
||||||
|
// int.TryParse를 사용하여 안전하게 정수형으로 변환
|
||||||
|
if (int.TryParse(splitData[0], out monster.id)) { }
|
||||||
|
else { Debug.LogError("id 필드 정수 변환 실패: " + splitData[0]); }
|
||||||
|
|
||||||
|
monster.name = splitData[1];
|
||||||
|
|
||||||
|
if (int.TryParse(splitData[2], out monster.level)) { }
|
||||||
|
else { Debug.LogError("level 필드 정수 변환 실패: " + splitData[2]); }
|
||||||
|
|
||||||
|
if (int.TryParse(splitData[3], out monster.hp)) { }
|
||||||
|
else { Debug.LogError("hp 필드 정수 변환 실패: " + splitData[3]); }
|
||||||
|
|
||||||
|
if (int.TryParse(splitData[4], out monster.attackPower)) { }
|
||||||
|
else { Debug.LogError("attackPower 필드 정수 변환 실패: " + splitData[4]); }
|
||||||
|
|
||||||
|
if (int.TryParse(splitData[5], out monster.defencePoser)) { }
|
||||||
|
else { Debug.LogError("defencePoser 필드 정수 변환 실패: " + splitData[5]); }
|
||||||
|
|
||||||
|
dicMonster.Add(monster.id.ToString(), monster); // id를 키로 사용
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
4
Gameton-06/Assets/Resources/Monster.csv
Normal file
4
Gameton-06/Assets/Resources/Monster.csv
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
id,name,level,hp,attackPower,defencePower
|
||||||
|
1,blueDragon,1,10,35,36
|
||||||
|
2,greenDragon,1,10,35,36
|
||||||
|
3,redDragon,1,10,35,36
|
||||||
|
7
Gameton-06/Assets/Resources/Monster.csv.meta
Normal file
7
Gameton-06/Assets/Resources/Monster.csv.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11dcce49e0f92e74680420494679e394
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user