private void UpdatePositionAndRotation(float deltaTime) { Vector3? nextPosition; Quaternion?nextRotation; trajectory = trajectory.NextPosition(deltaTime, transform.position, out nextPosition, out nextRotation); if (nextPosition != null) { transform.position = nextPosition.Value; } if (nextRotation != null) { transform.rotation = nextRotation.Value; } }
public void Init(Vector3[] controlPoints, Team team, int instantiatorID) { this.team = team; GetComponent <Renderer>().material.color = team.Color(); if (controlPoints.Length == 1) { trajectory = new StraightTrajectoryStrategy(controlPoints[0], speed); } else { trajectory = new CurvedTrajectoryState(controlPoints, speed); } if (PhotonNetwork.player.ID != instantiatorID) { UpdatePositionAndRotation(PlayersLatency.OneWayTripOtherPlayer()); } }