Example #1
0
    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);
    }
Example #2
0
    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));
    }
Example #3
0
    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));
    }
Example #4
0
    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));
    }
Example #5
0
    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));
    }
Example #6
0
    //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));
    }
Example #7
0
    //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));
    }
Example #8
0
    //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));
    }
Example #9
0
    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));
    }
Example #10
0
    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);
    }
Example #11
0
    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);
    }
Example #12
0
 void SendAudioBuffer()
 {
     sendBuffer = new StringBuilder(((int)PhaNetworkingMessager.MessageType.AudioUpdate).ToString() + " " + audioBuffer);
     PhaNetworkingAPI.SendTo(PhaNetworkingAPI.mainSocket, sendBuffer, currentBufferSize + 2, PhaNetworkingAPI.targetIP);
 }