Esempio n. 1
0
        /// <summary>
        /// Fires when the state exits, before the next state is entered into.
        /// </summary>
        public override void OnStateExit()
        {
            player.StartWallJumpMuting();

            float leftDist  = player.DistanceToLeftWall();
            float rightDist = player.DistanceToRightWall();

            if (player.IsTouchingLeftWall() || leftDist < rightDist)
            {
                physics.Velocity = settings.WallJump;
            }
            else if (player.IsTouchingRightWall() || rightDist >= leftDist)
            {
                physics.Velocity = new Vector2(-settings.WallJump.x, settings.WallJump.y);
            }

            if (cam == null)
            {
                cam = FindObjectOfType <TargettingCamera>();
            }

            if (cam != null)
            {
                TargettingCamera.ResetTracking(false, true);
            }
        }
Esempio n. 2
0
        //---------------------------------------------------------------------
        // Unity API
        //---------------------------------------------------------------------

        /// <summary>
        /// Grabs references to the vCam's settings and to the TargettingCamera
        /// </summary>
        private void Awake()
        {
            cameraSettings = transform.GetComponentInChildren <Camera>();

            if (cam == null)
            {
                cam = FindObjectOfType <TargettingCamera>();
            }
        }
Esempio n. 3
0
        //---------------------------------------------------------------------
        // Public Interface
        //---------------------------------------------------------------------

        /// <summary>
        /// Makes this virtual camera the target of the TargettingCamera
        /// </summary>
        public void Activate()
        {
            if (cam == null)
            {
                cam = FindObjectOfType <TargettingCamera>();
            }

            if (cam != null)
            {
                cam.SetTarget(cameraSettings, PanSpeed);
            }
        }
Esempio n. 4
0
        public void Shake()
        {
            if (cam == null)
            {
                cam = FindObjectOfType <TargettingCamera>();
            }

            if (cam != null)
            {
                cam.CameraShake(Duration, Delay, Intensity);
            }
        }
Esempio n. 5
0
        //-------------------------------------------------------------------------
        // Unity API
        //-------------------------------------------------------------------------

        private void Start()
        {
            if (background == null)
            {
                background = transform;
            }

            if (targettingCamera == null)
            {
                targettingCamera = FindObjectOfType <TargettingCamera>();
            }

            originalPosition = background.position;
        }
Esempio n. 6
0
        /// <summary>
        /// Activate the vCam the player is standing completely within over a partial collision.
        /// </summary>
        /// <param name="col">The collider that's intersecting the vCam collider</param>
        public void PullTriggerStay2D(Collider2D col)
        {
            if (col.gameObject.CompareTag("Player"))
            {
                if (TargettingCamera.target == null)
                {
                    if (cam == null)
                    {
                        cam = FindObjectOfType <TargettingCamera>();
                    }
                    TargettingCamera.ClearTarget();
                }

                if (TargettingCamera.target.transform.position != transform.position)
                {
                    Activate();
                }
            }
        }
Esempio n. 7
0
 private void ResetScene()
 {
     ResetManager.Reset();
     player.Respawn();
     TargettingCamera.ClearTarget();
 }
Esempio n. 8
0
 public void Unfocus()
 {
     TargettingCamera.ClearTarget();
 }
Esempio n. 9
0
 //-------------------------------------------------------------------------
 // Unity API
 //-------------------------------------------------------------------------
 private void Awake()
 {
     targettingCamera = FindObjectOfType <TargettingCamera>();
 }
Esempio n. 10
0
 /// <summary>
 /// Removes the target from the TargettingCamera
 /// </summary>
 public void Deactivate()
 {
     TargettingCamera.ClearTarget();
 }
 //-------------------------------------------------------------------------
 // Auto Node API
 //-------------------------------------------------------------------------
 public override void Handle(GraphEngine graphEngine)
 {
     TargettingCamera.ClearTarget();
 }