party #15

Merged
zephyr merged 4 commits from party into main 2023-08-07 11:34:42 -05:00
2 changed files with 19 additions and 6 deletions
Showing only changes of commit e8f581dea8 - Show all commits

View File

@ -31,7 +31,7 @@ Transform:
m_Children:
- {fileID: 4157508313357080045}
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7347972816793018538
MonoBehaviour:
@ -45,11 +45,12 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 583304b24f3e6394f9e4d49747e22193, type: 3}
m_Name:
m_EditorClassIdentifier:
Name:
Class: {fileID: 0}
Level: 0
XP: 0
Attrs: {fileID: 0}
name:
class_: {fileID: 0}
level: 0
xp: 0
attrs: {fileID: 0}
party: {fileID: 11400000, guid: c9a46588e6ec04d4d91bb80fdffd7869, type: 2}
--- !u!1 &4632618406133265053
GameObject:
m_ObjectHideFlags: 0

View File

@ -13,4 +13,16 @@ public class HeroUnit : MonoBehaviour
[SerializeField] private long level;
[SerializeField] private long xp;
[SerializeField] private HeroAttributesSO attrs;
[SerializeField] private HeroPartySO party;
private void OnEnable()
{
// NOTE(zeph): Party is mandatory. If none is set, we want an exception.
party.Add(this);
}
zephyr marked this conversation as resolved
Review

I think its clearer to make these types of notes into assertions. Assert.IsNotNull(party) or something like it.

I think its clearer to make these types of notes into assertions. `Assert.IsNotNull(party)` or something like it.
private void OnDisable()
{
party.Remove(this);
}
}