Skip to content

Commit 11c8d86

Browse files
committed
fix: migrated pre-existing code to Unity latest
1 parent 42c35c1 commit 11c8d86

224 files changed

Lines changed: 13055 additions & 300 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ trim_trailing_whitespace = true
1212
max_line_length = off
1313
trim_trailing_whitespace = false
1414

15-
[manifest.json]
15+
[*.json]
1616
indent_size = 2

Assets/Examples.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/Examples/HealthExample.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: b812d3dc4a4444adae812adfa041ca88, type: 3}
12+
m_Name: CharacterA
13+
m_EditorClassIdentifier:
14+
collection: {fileID: 11400000, guid: 0cda059b3069840fe94a9480fa84c45c, type: 2}
15+
overrides:
16+
overrides:
17+
- definition: {fileID: 11400000, guid: 3cf3e661c93fb496ca382be87b943584, type: 2}
18+
value:
19+
_valueInt:
20+
value: 5
21+
_valueIntCurve:
22+
value:
23+
serializedVersion: 2
24+
m_Curve: []
25+
m_PreInfinity: 2
26+
m_PostInfinity: 2
27+
m_RotationOrder: 4
28+
_valueFloat:
29+
value: 0
30+
_valueFloatCurve:
31+
value:
32+
serializedVersion: 2
33+
m_Curve: []
34+
m_PreInfinity: 2
35+
m_PostInfinity: 2
36+
m_RotationOrder: 4
37+
type: 0

Assets/Examples/HealthExample/CharacterA.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInternal: {fileID: 0}
8+
m_GameObject: {fileID: 0}
9+
m_Enabled: 1
10+
m_EditorHideFlags: 0
11+
m_Script: {fileID: 11500000, guid: b812d3dc4a4444adae812adfa041ca88, type: 3}
12+
m_Name: CharacterB
13+
m_EditorClassIdentifier:
14+
collection: {fileID: 11400000, guid: 0cda059b3069840fe94a9480fa84c45c, type: 2}
15+
overrides:
16+
overrides:
17+
- definition: {fileID: 11400000, guid: 3cf3e661c93fb496ca382be87b943584, type: 2}
18+
value:
19+
_valueInt:
20+
value: 5
21+
_valueIntCurve:
22+
value:
23+
serializedVersion: 2
24+
m_Curve: []
25+
m_PreInfinity: 2
26+
m_PostInfinity: 2
27+
m_RotationOrder: 4
28+
_valueFloat:
29+
value: 0
30+
_valueFloatCurve:
31+
value:
32+
serializedVersion: 2
33+
m_Curve: []
34+
m_PreInfinity: 2
35+
m_PostInfinity: 2
36+
m_RotationOrder: 4
37+
type: 0
38+
- definition: {fileID: 11400000, guid: 27355736af3274d11a63b95b6a5a14cf, type: 2}
39+
value:
40+
_valueInt:
41+
value: 20
42+
_valueIntCurve:
43+
value:
44+
serializedVersion: 2
45+
m_Curve: []
46+
m_PreInfinity: 2
47+
m_PostInfinity: 2
48+
m_RotationOrder: 4
49+
_valueFloat:
50+
value: 0
51+
_valueFloatCurve:
52+
value:
53+
serializedVersion: 2
54+
m_Curve: []
55+
m_PreInfinity: 2
56+
m_PostInfinity: 2
57+
m_RotationOrder: 4
58+
type: 0

Assets/Examples/HealthExample/CharacterB.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using Adnc.StatsSystem.Editors;
2+
using AdncStats.Scripts.StatsContainer;
3+
using UnityEngine;
4+
using UnityEngine.UI;
5+
6+
namespace Adnc.StatsSystem {
7+
[RequireComponent(typeof(StatsContainerExample))]
8+
public class CharacterExample : MonoBehaviour {
9+
[SerializeField] Slider healthBar;
10+
StatsContainer stats;
11+
12+
void Start () {
13+
stats = GetComponent<StatsContainerExample>().copy;
14+
15+
var health = stats.GetStat("health");
16+
healthBar.maxValue = health;
17+
healthBar.value = health;
18+
}
19+
20+
void Update () {
21+
healthBar.maxValue = stats.GetStat("health");
22+
}
23+
24+
public void ReceiveDamage (int damage) {
25+
healthBar.value -= Mathf.Max(0, damage - stats.GetStat("armor"));
26+
27+
if (healthBar.value < 1) {
28+
Destroy(gameObject);
29+
}
30+
}
31+
32+
public void AttackTarget (CharacterExample target) {
33+
if (target == null) return;
34+
35+
target.ReceiveDamage((int)stats.GetStat("attack"));
36+
}
37+
38+
public void AddHealth (float amount) {
39+
var health = stats.GetModifier(OperatorType.Add, "health", "example");
40+
stats.SetModifier(OperatorType.Add, "health", "example", health + amount);
41+
}
42+
43+
public void RemoveHealth (float amount) {
44+
var health = stats.GetModifier(OperatorType.Subtract, "health", "example");
45+
stats.SetModifier(OperatorType.Subtract, "health", "example", health + amount);
46+
}
47+
48+
public void MultiplyHealth (float amount) {
49+
var health = stats.GetModifier(OperatorType.Multiply, "health", "example");
50+
stats.SetModifier(OperatorType.Multiply, "health", "example", health + amount);
51+
}
52+
53+
public void DivideHealth (float amount) {
54+
var health = stats.GetModifier(OperatorType.Divide, "health", "example");
55+
stats.SetModifier(OperatorType.Divide, "health", "example", health + amount);
56+
}
57+
58+
public void RefillHealth () {
59+
healthBar.value = healthBar.maxValue;
60+
}
61+
62+
public void ClearAll () {
63+
stats.ClearAllModifiers(stats.GetRecord("health"), "example");
64+
}
65+
}
66+
}

Assets/Examples/HealthExample/CharacterExample.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)