Beispiel #1
0
        public void IniciarShake(ShakeAxis S = ShakeAxis.y, int totalShake = 5, float shakeAngle = 1)
        {
            //transform.rotation = Quaternion.identity;

            this.totalShake = totalShake;
            this.shakeAngle = shakeAngle;
            this.axis       = S;
            tempoDecorrido  = 0;
            contShake       = 0;
            estadoC         = EstadoComplementarDaCamera.shake;
        }
Beispiel #2
0
        public void Update()
        {
            if (testShake)
            {
                IniciarShake(axis, totalShake, shakeAngle);
                testShake = false;
            }

            switch (estadoC)
            {
            case EstadoComplementarDaCamera.shake:
                tempoDecorrido += Time.deltaTime;
                if (contShake < totalShake)
                {
                    ConditionalShake();
                    //transform.rotation = ConditionalShake(transform);

                    if (tempoDecorrido > tempoDeShake)
                    {
                        tempoDecorrido = 0;
                        contShake++;
                        sinal = !sinal;
                    }
                }
                else
                {
                    estadoC        = EstadoComplementarDaCamera.estabilizando;
                    tempoDecorrido = 0;
                }
                break;

            case EstadoComplementarDaCamera.estabilizando:
                tempoDecorrido += Time.deltaTime;
                if (tempoDecorrido <= tempoDeShake)
                {
                    transform.localEulerAngles = EstabilizadorCondicional();
                }
                else
                {
                    estadoC = EstadoComplementarDaCamera.estavel;
                    transform.localEulerAngles = new Vector3(
                        transform.localEulerAngles.x,
                        transform.localEulerAngles.y,
                        0
                        );
                }
                break;
            }
        }