예제 #1
0
    // Update is called once per frame
    private void Update()
    {
        // Check if the camera is not in the provided range of an object.
        if (_introMove && _movementHelper.IsNotInRange(ParentObject.gameObject.transform.position, 1f))
        {
            // If not, move the camera to that object.
            _movementHelper.Move(_rigidbody, ParentObject.gameObject.transform.position, 10f);
            return;
        }
        if (_introMove)
        {
            // The camera is close enough and the intro should end.
            FinishIntro();
        }

        // Player object no longer exists, maybe it got killed.
        // Just return instead.
        if (ParentObject == null)
        {
            return;
        }

        // Set the camera position to be above the parent's position.
        transform.position = new Vector3(ParentObject.transform.position.x, transform.localPosition.y, ParentObject.transform.position.z);
    }
 public bool TryJumpInDirection(Direction d)
 {
     if (CanJumpInDirection(d))
     {
         CurrentPoint = MovementHelper.Move(CurrentPoint, d, Size);
         return(true);
     }
     return(false);
 }
 public void JumpInDirection(Direction d)
 {
     if (CanJumpInDirection(d))
     {
         CurrentPoint = MovementHelper.Move(CurrentPoint, d, Size);
     }
     else
     {
         throw new ArgumentException("Cannot Jump in that direction.");
     }
 }
 public void JumpToPoint(MazePoint p)
 {
     CurrentPoint = MovementHelper.Move(CurrentPoint, p, Size);
 }