Пример #1
0
        private void Start()
        {
            this._fingerUtil        = new FingerUtil();
            this._swipeState        = new IslandCameraSwipeState(this);
            this._dampingState      = new IslandCameraDampingState(this);
            this._toLandedState     = new IslandCameraToLandedState(this);
            this._toFocusState      = new IslandCameraToFocusState(this);
            this._backToLandedState = new IslandCameraBackToLandedState(this);
            this._focusingState     = new IslandCameraFocusingState(this);
            this._backToBaseState   = new IslandCameraBackToBaseState(this);
            this._dragBackState     = new IslandCameraDragBackState(this);
            this._landingState      = new IslandCameraLandingState(this);
            Dictionary <E_IslandCameraState, IslandCameraBaseState> dictionary = new Dictionary <E_IslandCameraState, IslandCameraBaseState>();

            dictionary.Add(E_IslandCameraState.Swipe, this._swipeState);
            dictionary.Add(E_IslandCameraState.Damping, this._dampingState);
            dictionary.Add(E_IslandCameraState.ToLanded, this._toLandedState);
            dictionary.Add(E_IslandCameraState.ToFocus, this._toFocusState);
            dictionary.Add(E_IslandCameraState.BackToLanded, this._backToLandedState);
            dictionary.Add(E_IslandCameraState.Focusing, this._focusingState);
            dictionary.Add(E_IslandCameraState.BackToBase, this._backToBaseState);
            dictionary.Add(E_IslandCameraState.DragBack, this._dragBackState);
            dictionary.Add(E_IslandCameraState.Landing, this._landingState);
            this._stateDict = dictionary;
            this._mpb       = new AlphaLerpMaterialPropetyBlock(this._cover.GetComponent <MeshRenderer>(), "_Color", 0f, this._grayCoverAlpha);
            this._mpb.SetAlpha(0f);
            this._currentState = null;
            this.GotoState(E_IslandCameraState.Swipe, null);
            this.SetPivot(this._cameraBasePos.position);
            this._targetPivot   = this._cameraBasePos.position;
            this._lookAtPitch   = this._cameraBasePos.eulerAngles.x;
            this._lookAtDir     = this._cameraBasePos.forward;
            this._dragBackPoint = new DragBackPoint(this._cameraBasePos.position);
        }
Пример #2
0
        public override void Enter(IslandCameraBaseState lastState, object param = null)
        {
            base.Enter(lastState, param);
            this._dragBackPoint = param as DragBackPoint;
            this._startPos      = base._sm.GetPivot();
            this._toPos         = this._dragBackPoint._finalPos;
            this._startTime     = Time.time;
            Vector3 vector = this._toPos - this._startPos;

            this._totalTime = vector.magnitude / base._sm._dragBack_speed;
        }