forked from Team-Tototototoro/UnityCSV2SO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSampleCSVPopulableScriptableObject.cs
More file actions
48 lines (42 loc) · 1.96 KB
/
SampleCSVPopulableScriptableObject.cs
File metadata and controls
48 lines (42 loc) · 1.96 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System.Collections;
using System.Collections.Generic;
using UnityCSV2SO;
using UnityCSV2SO.PrimitiveData;
using UnityEngine;
[CreateAssetMenu(fileName = "SampleCSVPopulableScriptableObject", menuName = "CSVData/SampleCSVPopulableScriptableObject")]
public class SampleCSVPopulableScriptableObject : CSVPopulableScriptableObject
{
public float moveSpeed;
public float crouchMoveSpeed;
public float slideMoveSpeed;
public float wallrunSpeedStart;
public float wallrunSpeedEnd;
public float wallRunTime;
public float wallRunJump;
public float wallClimbMultiplier;
public float jumpSpeed;
#if UNITY_EDITOR
public override string CSVKey => "Player";
public override void UpdateSelf(ScriptableObject refToUpdate, ScriptableObject newValues)
{
throw new System.NotImplementedException();
}
protected override void SetValue<T>(string value, string key, ref T reference)
{
throw new System.NotImplementedException();
}
protected void PopulateData(PrimitiveDataDictionary dataDictionary)
{
void LogError() => Debug.LogError("Couldn't find value!");
if (!dataDictionary.TryGetFloat("MoveSpeed", out moveSpeed)) { LogError(); }
if (!dataDictionary.TryGetFloat("CrouchMoveSpeed", out crouchMoveSpeed)) { LogError(); }
if (!dataDictionary.TryGetFloat("SlideMoveSpeed", out slideMoveSpeed)) { LogError(); }
if (!dataDictionary.TryGetFloat("WallRunStartSpeed", out wallrunSpeedStart)) { LogError(); }
if (!dataDictionary.TryGetFloat("WallRunEndSpeed", out wallrunSpeedEnd)) { LogError(); }
if (!dataDictionary.TryGetFloat("WallRunTime", out wallRunTime)) { LogError(); }
if (!dataDictionary.TryGetFloat("WallRunJump", out wallRunJump)) { LogError(); }
if (!dataDictionary.TryGetFloat("WallClimbMultiplier", out wallClimbMultiplier)) { LogError(); }
if (!dataDictionary.TryGetFloat("JumpSpeed", out jumpSpeed)) { LogError(); }
}
#endif
}