//This method is called when receiving remote transform
	// We update lastState here to know last received transform state
	void ReceiveTransform(EsObject data) {
        Debug.Log("ReceiveTransform.  receiveMode = " + receiveMode.ToString());
		if (receiveMode) {

            Vector3 pos = NetworkTransform.getPlayerPosition(data);
            Quaternion rot = NetworkTransform.getPlayerRotation(data);
            lastState.InitFromValues(pos, rot);
		
			// Adding next received state to the queue	
			NetworkTransform nextState = new NetworkTransform(this.gameObject);
			nextState.InitFromValues(pos, rot);
			queue.Enqueue(nextState);
		}
	}
Exemplo n.º 2
0
    public void ReceiveTransform(SFSObject data)
    {
        Player player = base.gameObject.GetComponent("Player") as Player;

        if (receiveMode && player.mAmReady)
        {
            Vector3          pos              = new Vector3(Convert.ToSingle(data.GetFloat("x")), Convert.ToSingle(data.GetFloat("y")) + yAdjust, 0f);
            int              currentState     = Convert.ToInt32(data.GetInt("moveState"));
            float            armAngle         = Convert.ToSingle(data.GetFloat("armAngle"));
            int              moveDir          = Convert.ToInt32(data.GetInt("moveDir"));
            float            faceTargetDir    = Convert.ToSingle(data.GetFloat("faceTargetDir"));
            NetworkTransform networkTransform = new NetworkTransform(base.gameObject);
            networkTransform.InitFromValues(pos, currentState, armAngle, moveDir, faceTargetDir);
            queue.Enqueue(networkTransform);
        }
    }
Exemplo n.º 3
0
    //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);
        }
    }
Exemplo n.º 4
0
    //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));
        }
    }