SyncVar Updates (#660)

* Change SyncVar hooks to use `nameof`
I intentionally left the test for missing hook as a literal string because it won't compile otherwise.

* Removed unnecessary property value set from hook
This commit is contained in:
MrGadget 2019-03-26 10:40:28 -04:00 committed by vis2k
parent 68f63b5f69
commit d2868646fa
13 changed files with 12 additions and 13 deletions

View File

@ -61,7 +61,6 @@ public void CmdSendLevelLoaded()
private void ReadyStateChanged(bool NewReadyState) private void ReadyStateChanged(bool NewReadyState)
{ {
ReadyToBegin = NewReadyState;
OnClientReady(ReadyToBegin); OnClientReady(ReadyToBegin);
} }

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
class MySyncVar : NetworkBehaviour class MySyncVar : NetworkBehaviour

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
class MySyncVar : ScriptableObject class MySyncVar : ScriptableObject

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
[SyncVar] [SyncVar]

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
class MySyncVar<T> class MySyncVar<T>

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
interface MySyncVar interface MySyncVar

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
[SyncVar] int var2; [SyncVar] int var2;

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook = "OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
public void TakeDamage(int amount) public void TakeDamage(int amount)

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
[SyncVar] [SyncVar]

View File

@ -15,7 +15,7 @@ public void OnDeserializeDelta(NetworkReader reader) {}
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook = "OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
[SyncVar] [SyncVar]

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook = "OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
public void TakeDamage(int amount) public void TakeDamage(int amount)

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook="OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
[SyncVar] int var2; [SyncVar] int var2;

View File

@ -5,7 +5,7 @@ namespace MirrorTest
{ {
class MirrorTestPlayer : NetworkBehaviour class MirrorTestPlayer : NetworkBehaviour
{ {
[SyncVar(hook = "OnChangeHealth")] [SyncVar(hook = nameof(OnChangeHealth))]
int health; int health;
public void TakeDamage(int amount) public void TakeDamage(int amount)