use property rather than getter for hero party
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
[assembly: InternalsVisibleTo("TestsPlaymode")]
|
||||
@@ -16,21 +17,17 @@ public class HeroUnit : MonoBehaviour
|
||||
[SerializeField] private long level;
|
||||
[SerializeField] private long xp;
|
||||
[SerializeField] private HeroAttributesSO attrs;
|
||||
[SerializeField] private HeroPartySO party;
|
||||
[SerializeField] private HeroPartySO _party;
|
||||
internal HeroPartySO party => _party;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// NOTE(zeph): Party is mandatory. If none is set, we want an exception.
|
||||
party.Add(this);
|
||||
Assert.IsNotNull(_party);
|
||||
_party.Add(this);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
party.Remove(this);
|
||||
}
|
||||
|
||||
internal HeroPartySO getParty()
|
||||
{
|
||||
return party;
|
||||
_party.Remove(this);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user