当前位置: 首页>>代码示例>>C#>>正文


C# SFSObject.GetNumber方法代码示例

本文整理汇总了C#中SFSObject.GetNumber方法的典型用法代码示例。如果您正苦于以下问题:C# SFSObject.GetNumber方法的具体用法?C# SFSObject.GetNumber怎么用?C# SFSObject.GetNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SFSObject的用法示例。


在下文中一共展示了SFSObject.GetNumber方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReceiveTransform

    //This method is called when receiving remote transform
    // We update lastState here to know last received transform state
    void ReceiveTransform(SFSObject data)
    {
        Debug.Log("ReceiveTransform()");
        if (receiveMode) {
            Vector3 pos = new Vector3(Convert.ToSingle(data.GetNumber("x")),
                                        Convert.ToSingle(data.GetNumber("y")),
                                        Convert.ToSingle(data.GetNumber("z"))
                                        );

            Quaternion rot = new Quaternion(
                                        Convert.ToSingle(0.0),
                                        Convert.ToSingle(data.GetNumber("ry")),
                                        Convert.ToSingle(0.0),
                                        Convert.ToSingle(data.GetNumber("w"))
            );

            lastState.InitFromValues(pos, rot);

            // Adding next received state to the queue
            NetworkTransform nextState = new NetworkTransform(this.gameObject);
            nextState.InitFromValues(pos, rot);
            queue.Enqueue(nextState);
            Debug.Log("queue length: "+Convert.ToString(queue.Count));
        }
    }
开发者ID:ylyking,项目名称:lynea,代码行数:27,代码来源:NetworkTransformReceiver.cs

示例2: ReceiveHeading

    //This method is called when receiving remote heading
    // We update course here
    public void ReceiveHeading(SFSObject data)
    {
        if (receiveMode)
        {
            Vector3 pos = new Vector3(Convert.ToSingle(data.GetNumber("x")),
                                        Convert.ToSingle(data.GetNumber("y")),
                                        Convert.ToSingle(data.GetNumber("z"))
                                        );
            float angle = Convert.ToSingle(data.GetNumber("a"));
            long time = (long) data.GetNumber("t");
            float speed = Convert.ToSingle(data.GetNumber("s"));
            long accelerationTime = (long) data.GetNumber("at");
            float endSpeed = -1;
            if (accelerationTime != -1)
            {
                endSpeed = Convert.ToSingle(data.GetNumber("es"));
            }
            //Debug.Log("ReceiveHeading() has received a heading : "+pos+"; a="+angle+", s="+speed+", t="+time+", at="+accelerationTime+", es="+endSpeed);

            course.InitFromValues(pos, angle, time, speed, endSpeed, accelerationTime);
            if(hasReceivedHeading == true)
                CreateInterceptor();

            hasReceivedHeading = true;
        }
    }
开发者ID:ylyking,项目名称:lynea,代码行数:28,代码来源:HeadingReceiver.cs

示例3: ForceSendTransform

 private void ForceSendTransform(SFSObject data)
 {
     //if this message is addressed to this user
     if ((int)data.GetNumber("to_uid") == smartFoxClient.myUserId) {
         // Find local player object
         GameObject user = GameObject.Find("localPlayer");
         // Send him message
         if (user) user.SendMessage("ForceSendTransform");
     }
 }
开发者ID:Nivek12,项目名称:Hegira,代码行数:10,代码来源:NetworkController.cs

示例4: ReceiveTransform

    //This method is called when receiving remote transform
    // We update lastState here to know last received transform state
    void ReceiveTransform(SFSObject data)
    {
        if (receiveMode) {
            Vector3 pos = new Vector3(Convert.ToSingle(data.GetNumber("x")),
                                        Convert.ToSingle(data.GetNumber("y"))+yAdjust,
                                        Convert.ToSingle(data.GetNumber("z"))
                                        );

            Quaternion rot = new Quaternion(Convert.ToSingle(data.GetNumber("rx")),
                                        Convert.ToSingle(data.GetNumber("ry")),
                                        Convert.ToSingle(data.GetNumber("rz")),
                                        Convert.ToSingle(data.GetNumber("w"))

            );

            lastState.InitFromValues(pos, rot);

            // Adding next received state to the queue
            NetworkTransform nextState = new NetworkTransform(this.gameObject);
            nextState.InitFromValues(pos, rot);
            queue.Enqueue(nextState);
        }
    }
开发者ID:Nivek12,项目名称:Hegira,代码行数:25,代码来源:NetworkTransformReceiver.cs

示例5: OnExtensionResponse

    public void OnExtensionResponse(SFSObject data)
    {
        //Debug.Log("received request n°"+(++numReceive));

        responsePending = false;

        long serverTimeStamp = (long) data.GetNumber("t");
        AddTimeDelta(timeRequestSent, (long) (Time.time*1000), serverTimeStamp);

        if (bursting)
        {
            if (deltas.Count == maxDeltas)
            {
                ClockReady(EventArgs.Empty);
            }
            RequestServerTime();
        }
        //Debug.Log("latency = "+latency+", syncTimeDelta = " + syncTimeDelta);
    }
开发者ID:ylyking,项目名称:lynea,代码行数:19,代码来源:ServerClock.cs

示例6: OnObjectReceived

 // Here we process incoming SFS objects
 private void OnObjectReceived(SFSObject data, User fromUser)
 {
     //First determine the type of this object - what it contains ?
     String _cmd = data.GetString("_cmd");
     switch (_cmd) {
         case "t":  // "t" - means transform sync data
             SendTransformToRemotePlayerObject(data, fromUser);
             break;
         case "f":  // "f" - means force our local player to send his transform
             ForceSendTransform(data);
             break;
         case "a": // "a" - for animation message received
             SendAnimationMessageToRemotePlayerObject(data, fromUser);
             break;
         case "d": //"d" - for damage message received
             DamageLocalPlayer(data.GetNumber("amount"));
             break;
         case "k": //"k" - for player killed
             KillRemotePlayer();
             break;
     }
 }
开发者ID:Nivek12,项目名称:Hegira,代码行数:23,代码来源:NetworkController.cs


注:本文中的SFSObject.GetNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。