示例#1
0
 private void CheckPan()
 {
     if (Input.GetKeyDown(KeyCode.N))
     {
         mTheCamera.MoveBy(5f, 5f);
     }
     if (Input.GetKeyDown(KeyCode.M))
     {
         mTheCamera.MoveTo(mRefPoint.transform.position.x, mRefPoint.transform.position.y);
     }
 }
示例#2
0
    // Update is called once per frame
    void Update()
    {
        #region User Position Control
        transform.position += Input.GetAxis("Vertical") * transform.up *
                              (kHeroSpeed * Time.smoothDeltaTime);
        transform.position += Input.GetAxis("Horizontal") * transform.right *
                              (kHeroSpeed * Time.smoothDeltaTime);
        #endregion

        mHeroCam.MoveTo(transform.position.x, transform.position.y);

        #region Testing the Camera Support: Push and Collision Bound
        mTheCamera.PushCameraByPos(transform.position, WorldBoundRegion);

        // testing the intersection
        CameraSupport.WorldBoundStatus status = mTheCamera.CollideWorldBound(GetComponent <Renderer>().bounds, WorldBoundRegion);
        // Debug.Log("Hero Collision=" + status);
        #endregion

        #region Testing TimedLerp: using size

        if (Input.GetKeyDown(KeyCode.Z))
        {
            Vector3 finalScale = transform.localScale;
            transform.localScale += new Vector3(kDeltaSize, kDeltaSize, 0f);
            mSizeLerp.SetLerpParms(3f, 2f);
            mSizeLerp.BeginLerp(transform.localScale, finalScale);
            GameState.sGameState.IncLerpCount();
        }

        if (mSizeLerp.LerpIsActive())
        {
            Vector3 s = mSizeLerp.UpdateLerp();
            transform.localScale = new Vector3(s.x, s.y, 0.0f);
        }

        #endregion
    }