예제 #1
0
 private void GameListResponse(SFSObject sfsdata)
 {
     string[] gamelist = sfsdata.GetUtfStringArray("games");
     foreach (string s in gamelist) {
         Debug.Log(s);
         OnEvent("roomadd", s);
     }
 }
예제 #2
0
    public static void HandleObjectUpdate(SFSObject message)
    {
        string type = message.GetUtfString ("objectType");
        float xPos = message.GetFloat ("xPos");
        float yPos = message.GetFloat ("yPos");
        float zPos = message.GetFloat ("zPos");
        float xRot = message.GetFloat ("xRot");
        float yRot = message.GetFloat ("yRot");
        float zRot = message.GetFloat ("zRot");

        float xDir = message.GetFloat ("xDir");
        float yDir = message.GetFloat ("yDir");
        float zDir = message.GetFloat ("zDir");

        int blockType = message.GetInt ("blockType");

        string[] cubeIDs = message.GetUtfStringArray ("cubeIDs");
        string id = message.GetUtfString ("ID");
        int animType = message.GetInt ("charAnim");

        float Speed = message.GetFloat ("Speed");
        bool Hit = message.GetBool ("Hit");
        bool Jump = message.GetBool ("Jump");

        Vector3 position = new Vector3 (xPos, yPos, zPos);
        Quaternion rotation = Quaternion.Euler(new Vector3(xRot, yRot, zRot));
        Vector3 forward = new Vector3 (xDir, yDir, zDir);

        switch (type) {
        case "Block":
            UpdateBlockObject(blockType, id, cubeIDs, position, rotation);
            break;

        case "Bar":
                UpdateBarObject(id, position, rotation);
            break;

        case "Ball":
                UpdateBallObject(id, position, rotation);
            break;

        case "Character":
            UpdateCharacterObject (id, (CharacterAnimType)animType, position, rotation, forward, Speed, Hit, Jump);
            break;
        }
    }