Exemplo n.º 1
0
        public IEnumerator ShakeCoroutine()
        {
            this.CurrentMotion = CAMERA_MOTION_TYPE.SHAKE;

            float   _timerMax = this.ShakeTimeSecondsMax;
            Vector3 _posOrg   = this.transform.position;

            while (_timerMax > 0.0F)
            {
                _timerMax -= Time.deltaTime;
                Vector3 _offset = Random.insideUnitCircle * this.ShakeAmount;
                this.transform.position = _posOrg + _offset;
                yield return(null);
            }

            this.transform.position = _posOrg;
            this.CurrentMotion      = CAMERA_MOTION_TYPE.LOOKAT;
            yield break;
        }
Exemplo n.º 2
0
        void Start()
        {
            if (this.CameraScript == null)
            {
                this.CameraScript = GetComponent <Camera> ();
            }

            if (this.Target == null)
            {
                this.CurrentMotion = CAMERA_MOTION_TYPE.NONE;
            }

            if (this.LookAtTargetToCenter)
            {
                positionRelativeToTarget = Vector3.zero;
            }
            else
            {
                positionRelativeToTarget = transform.position - Target.position;
            }
            positionRelativeToTarget.z = transform.position.z;
        }