/// <summary> /// Initialise this instance. /// </summary> virtual public void Init() { myCamera = GetComponent <Camera> (); if (myCamera == null) { myCamera = GetComponentInParent <Camera> (); } currentZone = startingZone; }
/// <summary> /// Initialise this instance. /// </summary> override protected void Init() { if (transform.parent != null) { parentZone = transform.parent.GetComponentInParent <CameraZone> (); } if (parentZone == null) { Debug.LogError("A CameraTransitionPoint must be the child of a CameraZone"); } }
/// <summary> /// Changes the zone by smoothly animating to the new zone. /// </summary> /// <param name="newZone">The zone to move to.</param> override public void ChangeZone(CameraZone newZone) { if (tweener.Active) { tweener.Stop(); } tweener.TweenWithRate(tweenMode, transform, newZone.CameraPosition, transitionSpeed, ZoneHasBeenChanged); currentZone = null; targetZone = newZone; isInTransition = true; }
/// <summary> /// Changes the zone by immediately snapping to the new zones position. /// Overridden so we can also clear any movement items. /// </summary> /// <param name="newZone">New zone.</param> override public void ChangeZone(CameraZone newZone) { base.ChangeZone(newZone); movingInX = false; movingInY = false; distanceMovedLastFrameX = 0.0f; distanceMovedLastFrameY = 0.0f; if (freezePlayerDuringTransition && character != null) { character.enabled = false; } }
/// <summary> /// Changes the zone by immediately snapping to the new zones position. /// </summary> virtual public void ChangeZone(CameraZone newZone) { myCamera.transform.position = newZone.transform.position + new Vector3(0, 0, newZone.cameraZOffset); currentZone = newZone; }