Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 백준 17070번
- 백준 2870번
- 백준 c++ 2468번
- C#
- c++
- Beakjoon
- 2870번 수학숙제 c++
- 2468 c++
- Lv2
- Lv.3
- Algorithm
- dfs
- 백준 1103번
- 2870번 c++
- 백준 17070번 c++
- Unity
- 코테
- 수학숙제
- 2870번
- 백준
- 2870번 수학숙제
- 백준 c++ 2870번
- 백준 1103번 게임
- 백준 1103번 c++
- 유니티
- 17070번
- 플레이어 이동
- 코딩테스트
- 프로그래머스
- 오브젝트 풀링
Archives
- Today
- Total
주녘공부일지
[더 챌린저스] 게임 내 데이터 관리 본문
1. 제이슨 데이터 관리
- 제이슨 데이터를 빠르고 편리하게 사용하기 위해 파싱해서 딕셔너리로 사용
public void Init()
{
SkillDict = LoadJson<SkillData, int, Skill>("SkillData").MakeDict();
CharInfoDict = LoadJson<CharacterData, int, CharacterInfo>("CharacterData").MakeDict();
}
Loader LoadJson<Loader, Key, Value>(string path) where Loader : ILoader<Key, Value>
{
TextAsset textAsset = Managers.Resource.Load<TextAsset>($"Data/{path}");
return JsonUtility.FromJson<Loader>(textAsset.text);
}
[Serializable]
public class Skill
{
public int skillType; // ENUM_SKILL_TYPE (Key)
public float damage;
public float runTime;
public float stunTime;
public float risingPower;
public float pushingPower;
public int hitSoundType; // ENUM_SFX_TYPE (히트사운드)
}
public class SkillData : ILoader<int, Skill>
{
public List<Skill> Skills = new List<Skill>();
public Dictionary<int, Skill> MakeDict()
{
Dictionary<int, Skill> skillDict = new Dictionary<int, Skill>();
foreach (Skill skill in Skills)
skillDict.Add(skill.skillType, skill);
return skillDict;
}
}
{
"Skills": [
{
"skillType": 1,
"damage": 2.0,
"runTime": 0.2,
"stunTime": 0.35,
"risingPower": 0,
"pushingPower": 2.5,
"hitSoundType" : 301
},
{
"skillType": 2,
"damage": 2.0,
"runTime": 0.2,
"stunTime": 0.35,
"risingPower": 0,
"pushingPower": 2.5,
"hitSoundType" : 302
},
...
]
}
2. PlayerPrefs
유니티에서 제공해주는 데이터 관리 클래스로 유저가 게임 내에서 세팅한 정보를 저장, 불러오기하기 위해 사용
- 해당 클래스는 int, float, string 타입만 지원하기 때문에 동시에 사용되는 데이터의 일부만 저장, 불러오기를 할 수 없도록 데이터 클래스로 묶어서 사용함
ex) 키 설정 값, 볼륨 크기 및 뮤트 상태
[Serializable]
public class KeySettingData
{
public List<KeySettingDataElement> keySettingDataList = new List<KeySettingDataElement>();
public float opacity;
public KeySettingData(List<KeySettingDataElement> _keySettingDataList, float _opacity)
{
keySettingDataList = _keySettingDataList;
opacity = _opacity;
}
}
[Serializable]
public class KeySettingDataElement
{
public int key; // ENUM_KEYSETTING_NAME의 번호 (키 값)
public float scaleSize;
public float rectTrX;
public float rectTrY;
public KeySettingDataElement(int _key, float scaleSize, float _rectTrX, float _rectTrY)
{
this.key = _key;
this.scaleSize = scaleSize;
this.rectTrX = _rectTrX;
this.rectTrY = _rectTrY;
}
}
https://godgjwnsgur7.tistory.com/55
[더 챌린저스] 키 설정 시스템
1. 키 설정 시스템 - 인게임 내에서 유저에게 불편함을 줄 수 있는 입력 키들은 고정으로 위치 및 크기를 정해주기엔 개수가 너무 많다고 판단해서 유저가 위치, 크기, 투명도 등을 직접 변경하여
godgjwnsgur7.tistory.com
'GameDevelopment > [Unity] Project' 카테고리의 다른 글
[페인트 맨] 파이어베이스 DB 관리 (0) | 2024.03.29 |
---|---|
[페인트 맨] 다국어 지원 시스템 (Localization) (0) | 2024.03.29 |
[퍼즐 게임] 게임 플레이 영상, 매칭 이벤트 (0) | 2023.09.29 |
[컴공생 키우기] 미니게임 (0) | 2023.08.16 |
[더 챌린저스] 키 설정 시스템 (0) | 2023.07.14 |