예제 #1
0
 public void Initialize(PlayerController playerController)
 {
     this.playerController = playerController;
     forwardSpeed          = playerController.GetModel().ForwardSpeed;
     laneDistance          = playerController.GetModel().LaneDistance;
     minDesiredLane        = playerController.GetModel().MinDesiredLane;
     maxDesiredLane        = playerController.GetModel().MaxDesiredLane;
 }
예제 #2
0
        private void CalculatingPlayerNextPos()
        {
            Vector3 targetPosition = transform.position.z * transform.forward + transform.position.y * transform.up;

            if (desiredLane == 0)
            {
                targetPosition += Vector3.left * laneDistance;
            }
            else if (desiredLane == 2)
            {
                targetPosition += Vector3.right * laneDistance;
            }

            transform.position = Vector3.Lerp(transform.position, targetPosition,
                                              playerController.GetModel().LaneChangeTime *Time.deltaTime);
        }