Exemple #1
0
    // Use this for initialization
    public void Initialise()
    {
        _lerpPosition = this.GetComponent <LerpPosition>();
        _lerpRotation = this.GetComponent <LerpRotation>();
        _defaultLayer = this.gameObject.layer;

        //event listener
        _lerpPosition.OnLerpFinished += _lerpPosition_OnLerpFinished;
    }
Exemple #2
0
    // Use this for initialization
	public void Initialise () 
    {
        _lerpPosition = this.GetComponent<LerpPosition>();
		_lerpRotation = this.GetComponent<LerpRotation>();
        _defaultLayer = this.gameObject.layer;

        //event listener
        _lerpPosition.OnLerpFinished += _lerpPosition_OnLerpFinished;
	}
Exemple #3
0
    void OnPlayerTransform(string data)
    {
        // # (both) 更新玩家位置:玩家id|localPosition|localRotation|localScale
        string[] dataSplit = data.Split('|');

        bool ignore   = false;
        int  playerId = int.Parse(dataSplit[0]);

        if (me != null)
        {
            if (me.playerId == playerId)
            {
                ignore = true;
            }
        }

        if (ignore)
        {
            return;
        }
        else
        {
            for (int i = 0; i < playersInScene.Count; i++)
            {
                if (playersInScene[i] == null)
                {
                    continue;
                }

                if (playersInScene[i].playerId == playerId)
                {
                    Vector3 pos = connectionAgent.ParseStringToVector(dataSplit[1]);
                    Vector3 rot = connectionAgent.ParseStringToVector(dataSplit[2]);
                    Vector3 sca = connectionAgent.ParseStringToVector(dataSplit[3]);

                    LerpPosition lp = playersInScene[i].GetComponent <LerpPosition>();
                    lp.targetPosition = pos;
                    //playersInScene[i].transform.position = pos;
                    playersInScene[i].transform.eulerAngles = rot;
                    playersInScene[i].transform.localScale  = sca;
                }
            }
        }
    }