Esempio n. 1
0
    public virtual void UpdatePlayerPosition(PharusTransmission.TrackRecord trackRecord)
    {
        foreach (ATrackingEntity aPlayer in _playerList)
        {
            if (aPlayer.TrackID == trackRecord.trackID)
            {
                aPlayer.AbsolutePosition             = new Vector2(trackRecord.currentPos.x, trackRecord.currentPos.y);
                aPlayer.NextExpectedAbsolutePosition = new Vector2(trackRecord.expectPos.x, trackRecord.expectPos.y);
                aPlayer.RelativePosition             = new Vector2(trackRecord.relPos.x, trackRecord.relPos.y);
                aPlayer.Orientation = new Vector2(trackRecord.orientation.x, trackRecord.orientation.y);
                aPlayer.Speed       = trackRecord.speed;
                // use AddToVector2List() instead of ToVector2List() as it is more performant
                aPlayer.Echoes.Clear();
                trackRecord.echoes.AddToVector2List(aPlayer.Echoes);
                aPlayer.SetPosition(UnityPharusManager.GetScreenPositionFromRelativePosition(trackRecord.relPos));
                aPlayer.SetPosition(TrackingAdapter.GetScreenPositionFromRelativePosition(trackRecord.relPos.x, trackRecord.relPos.y));
                return;
            }
        }

        if (_addUnknownPlayerOnUpdate)
        {
            AddPlayer(trackRecord);
        }
    }
Esempio n. 2
0
 private void OnTrackUpdated(object sender, UnityPharusEventProcessor.PharusEventTrackArgs e)
 {
     UpdatePlayerPosition(e.trackRecord.trackID, UnityPharusManager.GetScreenPositionFromRelativePosition(e.trackRecord.relPos));
 }