public void Initialize(NinjaBehaviour.NinjaColor ninjaColor, bool useNetwork) { this.noNetwork = !useNetwork; this.color = ninjaColor; this.health = maxHealth; this.score = 0; }
void Update() { if (currentNinjaColor != ninjaColor) { switch (ninjaColor) { case NinjaColor.Blue: ChangeTexture("Ninja_Mesh", ninjaTextures[0]); break; case NinjaColor.Green: ChangeTexture("Ninja_Mesh", ninjaTextures[1]); break; case NinjaColor.Red: ChangeTexture("Ninja_Mesh", ninjaTextures[2]); break; default: break; } currentNinjaColor = ninjaColor; } if (currentSwordColor != swordColor) { switch (swordColor) { case SwordColor.Blue: ChangeTexture("Scabbard_Mesh", swordTextures[0]); ChangeTexture("Sword_Mesh", swordTextures[0]); break; case SwordColor.Green: ChangeTexture("Scabbard_Mesh", swordTextures[1]); ChangeTexture("Sword_Mesh", swordTextures[1]); break; case SwordColor.Red: ChangeTexture("Scabbard_Mesh", swordTextures[2]); ChangeTexture("Sword_Mesh", swordTextures[2]); break; default: break; } currentSwordColor = swordColor; } }
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) { int n = (int)color; stream.Serialize(ref n); color = (NinjaColor)n; stream.Serialize(ref health); stream.Serialize(ref score); if (!stream.isWriting) { UpdateHUD(); } }
void OnSerializeNetworkView(BitStream stream, NetworkMessageInfo info) { int n = (int) color; stream.Serialize(ref n); color = (NinjaColor) n; stream.Serialize(ref health); stream.Serialize(ref score); if (!stream.isWriting) { UpdateHUD(); } }