LaunchPacket.ToSFSObject C# (CSharp) Method

ToSFSObject() public method

public ToSFSObject ( ISFSObject data ) : ISFSObject
data ISFSObject
return ISFSObject
    public ISFSObject ToSFSObject(ISFSObject data)
    {
        ISFSObject launchMessage = new SFSObject();

        //Message
        launchMessage.PutUtfString("messageType", type);

        //side hit id
        launchMessage.PutInt("cubeID", cubeID);

        //side hit id
        launchMessage.PutInt("sideID", sideID);

        // Launch Position
        launchMessage.PutFloat("sx", this.launchPosition.x);
        launchMessage.PutFloat("sy", this.launchPosition.y);
        launchMessage.PutFloat("sz", this.launchPosition.z);

        // Launch Destination
        launchMessage.PutFloat("ex", this.launchDestination.x);
        launchMessage.PutFloat("ey", this.launchDestination.y);
        launchMessage.PutFloat("ez", this.launchDestination.z);

        //Local Game Time
        launchMessage.PutDouble("localGameTime", this.localGameTime);

        //Local Game Time
        launchMessage.PutDouble("gameTimeETA", this.gameTimeETA);

        //Local Game Time
        launchMessage.PutBool("paint", this.paint);

        data.PutSFSObject("launchMessage", launchMessage);

        return data;
    }

Usage Example

コード例 #1
0
ファイル: GameManager.cs プロジェクト: ice0001/Cubes-in-Space
    //send out a launch message to all other players that you are moving somewhere
    public void SendLaunchMessage(LaunchPacket launchMessage)
    {
        Debug.Log("Sending Launch Message");
        ISFSObject data = new SFSObject();
        data.GetSFSObject("launchMessage");

        data = launchMessage.ToSFSObject(data);
        smartFox.Send(new ObjectMessageRequest(data));
    }