public void U2UMState(AttackState state) { if (PhotonNetwork.isMasterClient) { SendState(state.ToString()); } else if (PhotonNetwork.isNonMasterClientInRoom) { photonView.RPC("SendState", PhotonTargets.MasterClient, state.ToString()); } }
public string ToString(string format) { return(format. Replace("#mh", maxHealth + ""). Replace("#m", mana + ""). Replace("#M", MANA + ""). Replace("#h", health + ""). Replace("#H", HEALTH + ""). Replace("#a", attack + ""). Replace("#A", ATTACK + ""). Replace("#s", state.ToString("G")). Replace("#n", name). Replace("#z", zone.type.ToString("G"))); }
public void SerializeState(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { int targetCheck; if (target == null) { targetCheck = 0; } else { targetCheck = target.transform.GetComponent <PhotonView>().viewID; } stream.SendNext(targetCheck); stream.SendNext(pivot.x); stream.SendNext(pivot.y); stream.SendNext(pivot.z); stream.SendNext(pivot.w); stream.SendNext(currentState.ToString()); } else { int targetCheck = (int)stream.ReceiveNext(); if (targetCheck != 0) { target = RetrieveTarget(targetCheck); } else { target = null; } float x = (float)stream.ReceiveNext(); float y = (float)stream.ReceiveNext(); float z = (float)stream.ReceiveNext(); float w = (float)stream.ReceiveNext(); pivot = new Quaternion(x, y, z, w); currentState = RetrieveState((string)stream.ReceiveNext()); } }
private void SetAttackState(AttackState state) { Console.WriteLine(this.ToString() + " AttackState[" + attackState.ToString() + "->" + state.ToString() + "]"); attackState = state; }