public void SendTopScore() { string[] splitScores = scores.Split(' '); StringBuilder sendBuffer = new StringBuilder(((int)PhaNetworkingMessager.MessageType.ScoreUpdate).ToString() + " " + splitScores[0] + " " + splitScores[1] + " " + splitScores[2]); PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, PhaNetworkingAPI.targetIP); }
public int SendDoorUpdate(int id, Vector3 position, Quaternion rotation) { StringBuilder sendBuffer = new StringBuilder(((int)MessageType.DoorUpdate).ToString() + " " + id.ToString() + " " + position.x.ToString() + " " + position.y.ToString() + " " + position.z.ToString() + " " + rotation.x.ToString() + " " + rotation.y.ToString() + " " + rotation.z.ToString() + " " + rotation.w.ToString()); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, PhaNetworkingAPI.targetIP)); }
public int SendPlayerUpdate(Vector3 position, Vector3 velocity, Quaternion orientation, StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder( ((int)MessageType.PlayerUpdate).ToString() + " " + position.x + " " + position.y + " " + position.z + " " + velocity.x + " " + velocity.y + " " + velocity.z + " " + orientation.w + " " + orientation.x + " " + orientation.y + " " + orientation.z, recvBufferSize); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
public int SendEnemyUpdate(Vector3 position, Quaternion orientation, int index, StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder( ((int)MessageType.EnemyUpdate).ToString() + " " + index.ToString() + " " + position.x + " " + position.y + " " + position.z + " " + orientation.w + " " + orientation.x + " " + orientation.y + " " + orientation.z, recvBufferSize); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
public int SendConsoleMessage(string message, StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder(((int)PhaNetworkingMessager.MessageType.ConsoleMessage).ToString() + " " + message); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
//Send a message to inform the other player to begin loading the level. public int SendLoadLevelMessage(StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder(((int)MessageType.LoadLevel).ToString()); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
//Send a message informing the other player what character you have chosen. public int SendCharacterLockMessage(int choice, StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder(((int)MessageType.CharacterLock).ToString() + " " + choice.ToString()); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
//Tell the other player that you are online public int SendConnectionMessage(StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder(((int)MessageType.Connection).ToString(), recvBufferSize); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
public int SendHealthUpdate(int damageTaken, StringBuilder givenAddress) { StringBuilder sendBuffer = new StringBuilder(((int)MessageType.HealthUpdate).ToString() + " " + damageTaken.ToString()); return(PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, sendBuffer.Length, givenAddress)); }
void SendVoiceCodeUpdate(ref CodeVoice speaker, int index) { StringBuilder doorCode = new StringBuilder(((int)MessageType.DoorUpdate).ToString() + " " + -2 + " " + index + " " + speaker.getCode()); PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, doorCode, doorCode.Length, PhaNetworkingAPI.targetIP); }
void SendDoorCodeUpdate(ref GoodDoor givenDoor) { StringBuilder doorCode = new StringBuilder(((int)MessageType.DoorUpdate).ToString() + " " + -1 + " " + givenDoor.transform.parent.name + " " + givenDoor.GetCode()); PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, doorCode, doorCode.Length, PhaNetworkingAPI.targetIP); }
void SendAudioBuffer() { sendBuffer = new StringBuilder(((int)PhaNetworkingMessager.MessageType.AudioUpdate).ToString() + " " + audioBuffer); PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, currentBufferSize + 2, PhaNetworkingAPI.targetIP); }