private void MotoUpAnim(bool play)
 {
     if (play)
     {
         if (motoJumpState == null)
         {
             motoJumpState = playerLado.animation.FadeIn("8_Moto(SubindoNoAr)", -1, -1, 22, null, AnimationFadeOutMode.Single);
         }
         else
         {
             motoJumpState.weight = 1;
             motoJumpState.Play();
         }
         state = State.MotoUp;
     }
     else
     {
         if (motoJumpState == null)
         {
             return;
         }
         else
         {
             motoJumpState.Stop();
             motoJumpState.weight = 0;
         }
     }
 }
    private void MotoWalkAnim(bool play)
    {
        if (play)
        {
            if (motoWalkState == null)
            {
                motoWalkState = playerLado.animation.FadeIn("8_Moto(Andando)", -1, -1, 21, null, AnimationFadeOutMode.Single);
            }
            else
            {
                motoWalkState.weight = 1f;
                motoWalkState.Play();
            }
            state = State.MotoWalk;
        }

        else
        {
            if (motoWalkState == null)
            {
                return;
            }
            else
            {
                motoWalkState.Stop();
                motoWalkState.weight = 0;
            }
        }
    }
 private void MotoFallAnim(bool play)
 {
     if (play)
     {
         if (motoFallState == null)
         {
             motoFallState = playerLado.animation.FadeIn("8_Moto(DescendoNoAr)", 0.1f, -1, 20, null, AnimationFadeOutMode.Single);
         }
         else
         {
             motoFallState.weight = 1;
             motoFallState.Play();
         }
         state = State.MotoDown;
     }
     else
     {
         if (motoFallState == null)
         {
             return;
         }
         else
         {
             motoFallState.Stop();
             motoFallState.weight = 0;
         }
     }
 }
    private void MotoLandAnim(bool play)
    {
        if (play)
        {
            if (motoLandState == null)
            {
                motoLandState             = playerLado.animation.FadeIn("8_Moto(Aterrisando)", 0.1f, -1, 3, null, AnimationFadeOutMode.Single);
                motoLandState.resetToPose = true;
            }
            else
            {
                motoLandState.weight = 1;
                motoLandState.Play();
            }

            state = State.MotoLand;
        }
        else
        {
            if (motoLandState == null)
            {
                return;
            }
            else
            {
                motoLandState.Stop();
                motoLandState.weight = 0;
            }
        }
    }
Exemplo n.º 5
0
    private void ChutandoAnim(bool play)
    {
        if (play)
        {
            playerLado.animation.lastAnimationState.weight = 0;

            if (chuteState == null)
            {
                chuteState = playerLado.animation.FadeIn("3_Bicuda", 0.1f, -1, 4, null, AnimationFadeOutMode.None);
                chuteState.displayControl = true;
                chuteState.resetToPose    = true;
            }
            else
            {
                chuteState.displayControl = true;
                chuteState.weight         = 1;
                chuteState.Play();
            }
            state = State.Chutando;
        }
        else
        {
            if (chuteState == null)
            {
                return;
            }
            else
            {
                chuteState.displayControl = false;
                chuteState.Stop();
                chuteState.weight = 0;
            }
        }
    }
Exemplo n.º 6
0
    private void GanhouAnim(bool play)
    {
        if (play)
        {
            playerFrente.animation.lastAnimationState.weight = 0;
            if (winState == null)
            {
                winState = playerFrente.animation.FadeIn("2_Vencer", 0.1f, -1, 12, null, AnimationFadeOutMode.Single);
                winState.displayControl = true;
            }
            else
            {
                winState.displayControl = true;
                winState.weight         = 1;
                winState.Play();
            }

            state = State.Ganhou;
        }
        else
        {
            if (winState == null)
            {
                return;
            }
            else
            {
                winState.displayControl = false;
                winState.weight         = 0;
                winState.Stop();
            }
        }
    }
Exemplo n.º 7
0
        /**
         * @language zh_CN
         * 播放动画。
         * @param animationName 动画数据名称,如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放上一个正在播放的动画。
         * @param playTimes 播放次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次]
         * @returns 对应的动画状态。
         * @see DragonBones.AnimationState
         * @version DragonBones 3.0
         */
        public AnimationState Play(string animationName = null, int playTimes = -1)
        {
            _animationConfig.Clear();
            _animationConfig.playTimes     = playTimes;
            _animationConfig.fadeInTime    = 0.0f;
            _animationConfig.animationName = animationName;

            if (!string.IsNullOrEmpty(animationName))
            {
                PlayConfig(_animationConfig);
            }
            else if (_lastAnimationState == null)
            {
                var defaultAnimation = _armature.armatureData.defaultAnimation;
                if (defaultAnimation != null)
                {
                    _animationConfig.animationName = defaultAnimation.name;
                    PlayConfig(_animationConfig);
                }
            }
            else if (!_isPlaying || (!_lastAnimationState.isPlaying && !_lastAnimationState.isCompleted))
            {
                _isPlaying = true;
                _lastAnimationState.Play();
            }
            else
            {
                _animationConfig.animationName = _lastAnimationState.name;
                PlayConfig(_animationConfig);
            }

            return(_lastAnimationState);
        }
Exemplo n.º 8
0
    private void StunAnim(bool play)
    {
        if (play)
        {
            playerFrente.animation.lastAnimationState.weight = 0;
            if (stunState == null)
            {
                stunState = playerFrente.animation.FadeIn("3_Atordoado", 0.1f, -1, 10, null, AnimationFadeOutMode.Single);
                stunState.displayControl = true;
            }
            else
            {
                stunState.displayControl = true;
                stunState.weight         = 1;
                stunState.Play();
            }

            state = State.Stun;
        }
        else
        {
            if (stunState == null)
            {
                return;
            }
            else
            {
                stunState.displayControl = false;
                stunState.weight         = 0;
                stunState.Stop();
            }
        }
    }
        /**
         * @language zh_CN
         * 播放动画。
         * @param animationName 动画数据的名称,如果未设置,则播放默认动画,或将暂停状态切换为播放状态,或重新播放上一个正在播放的动画。
         * @param playTimes 动画需要播放的次数。 [-1: 使用动画数据默认值, 0: 无限循环播放, [1~N]: 循环播放 N 次]
         * @returns 返回控制这个动画数据的动画状态。
         * @see dragonBones.AnimationState
         * @version DragonBones 3.0
         */
        public AnimationState Play(string animationName = null, int playTimes = -1)
        {
            var animationState = (AnimationState)null;

            if (DragonBones.IsAvailableString(animationName))
            {
                animationState = FadeIn(animationName, 0.0f, playTimes, 0, null, AnimationFadeOutMode.All);
            }
            else if (_lastAnimationState == null)
            {
                var defaultAnimation = _armature.armatureData.defaultAnimation;
                if (defaultAnimation != null)
                {
                    animationState = FadeIn(defaultAnimation.name, 0.0f, playTimes, 0, null, AnimationFadeOutMode.All);
                }
            }
            else if (!_isPlaying || (!_lastAnimationState.isPlaying && !_lastAnimationState.isCompleted))
            {
                _isPlaying = true;
                _lastAnimationState.Play();
            }
            else
            {
                animationState = FadeIn(_lastAnimationState.name, 0.0f, playTimes, 0, null, AnimationFadeOutMode.All);
            }

            return(animationState);
        }
 private void ManobraAnim(bool play)
 {
     if (play)
     {
         if (trickState == null)
         {
             trickState             = playerLado.animation.FadeIn("8_Moto(Empinando)", 0.1f, -1, 4, null, AnimationFadeOutMode.Single);
             trickState.resetToPose = true;
         }
         else
         {
             trickState.weight = 1;
             trickState.Play();
         }
         state = State.MotoGrau;
     }
     else
     {
         if (trickState == null)
         {
             return;
         }
         else
         {
             trickState.Stop();
             trickState.weight = 0;
         }
     }
 }
Exemplo n.º 11
0
    private void PerdeuAnim(bool play)
    {
        if (play)
        {
            playerFrente.animation.lastAnimationState.weight = 0;
            if (loseState == null)
            {
                loseState = playerFrente.animation.FadeIn("2_Perder", 0.1f, -1, 11, null, AnimationFadeOutMode.Single);
                loseState.displayControl = true;
            }
            else
            {
                loseState.displayControl = true;
                loseState.weight         = 1;
                loseState.Play();
            }

            state = State.Perdeu;
        }
        else
        {
            if (loseState == null)
            {
                return;
            }
            else
            {
                loseState.displayControl = false;
                loseState.weight         = 0;
                loseState.Stop();
            }
        }
    }
Exemplo n.º 12
0
    private void IdleAnim(bool play)
    {
        if (play)
        {
            landParticles.particleLoop.Stop();
            playerFrente.animation.lastAnimationState.weight = 0;
            if (idleState == null)
            {
                idleState = playerFrente.animation.FadeIn("0_Idle", 0.1f, -1, 15, null, AnimationFadeOutMode.None);
                idleState.displayControl = true;
            }
            else
            {
                idleState.displayControl = true;
                idleState.weight         = 1;
                idleState.Play();
            }

            state = State.Idle;
        }
        else
        {
            if (idleState == null)
            {
                return;
            }
            else
            {
                idleState.displayControl = fallState;
                idleState.weight         = 0;
                idleState.Stop();
            }
        }
    }
Exemplo n.º 13
0
    private void JumpAnim(bool play)
    {
        if (play)
        {
            playerLado.animation.lastAnimationState.weight = 0;
            landParticles.PlayLand();

            if (jumpState == null)
            {
                jumpState = playerLado.animation.FadeIn("1_NoAr(1_Subindo)", -1, -1, 22, null, AnimationFadeOutMode.Single);
                jumpState.displayControl = false;
            }
            else
            {
                //jumpState.displayControl = true;
                jumpState.weight = 1;
                jumpState.Play();
            }
            state = State.Rising;
        }
        else
        {
            if (jumpState == null)
            {
                return;
            }
            else
            {
                jumpState.displayControl = false;
                jumpState.Stop();
                jumpState.weight = 0;
            }
        }
    }
Exemplo n.º 14
0
    private void WalkAnim(bool play)
    {
        if (play)
        {
            playerLado.animation.lastAnimationState.weight = 0;
            landParticles.WalkParticles();
            if (walkState == null)
            {
                walkState = playerLado.animation.FadeIn("0_Corrida_V2", -1, -1, 21, null, AnimationFadeOutMode.Single);
                walkState.displayControl = false;
            }
            else
            {
                //walkState.displayControl = true;
                walkState.weight = 1f;
                walkState.Play();
            }
            state = State.Walking;
        }

        else
        {
            landParticles.particleLoop.Stop();
            if (walkState == null)
            {
                return;
            }
            else
            {
                walkState.displayControl = false;
                walkState.Stop();
                walkState.weight = 0;
            }
        }
    }
Exemplo n.º 15
0
    private void FallingAnim(bool play)
    {
        if (play)
        {
            playerLado.animation.lastAnimationState.weight = 0;

            if (fallState == null)
            {
                fallState = playerLado.animation.FadeIn("1_NoAr(2_Descendo)", 0.1f, -1, 20, null, AnimationFadeOutMode.Single);
                fallState.displayControl = false;
            }
            else
            {
                //fallState.displayControl = true;
                fallState.weight = 1;
                fallState.Play();
            }
            state = State.Falling;
        }
        else
        {
            if (fallState == null)
            {
                return;
            }
            else
            {
                fallState.displayControl = false;
                fallState.Stop();
                fallState.weight = 0;
            }
        }
    }
 private void CrashAnim(bool play)
 {
     if (play)
     {
         if (crashState == null)
         {
             crashState = playerLado.animation.FadeIn("8_Moto(Batendo)", 0.1f, -1, 10, null, AnimationFadeOutMode.Single);
         }
         else
         {
             crashState.weight = 1;
             crashState.Play();
         }
         Debug.Log("Crash");
         state = State.MotoCrash;
     }
     else
     {
         if (crashState == null)
         {
             return;
         }
         else
         {
             crashState.weight = 0;
             crashState.Stop();
         }
     }
 }
Exemplo n.º 17
0
    private void CarroWalkAnim(bool play)
    {
        if (play)
        {
            landParticles.CarPaticles();
            if (pipaState != null)
            {
                pipaState = null;
            }
            if (tiroState != null)
            {
                tiroState = null;
            }

            playerLado.animation.lastAnimationState.weight = 0;

            if (carroWalkState == null)
            {
                carroWalkState = playerLado.animation.FadeIn("6_Rolima(Andando)", 0.1f, -1, 6, null, AnimationFadeOutMode.None);
                carroWalkState.displayControl = true;
            }
            else
            {
                ActivateCarro(true);

                carroWalkState.displayControl = true;
                carroWalkState.weight         = 1;
                carroWalkState.Play();

                Debug.Log("CArroWalk = " + carroWalkState.name);
            }
            state = State.CarroWalk;
        }
        else
        {
            if (carroWalkState == null)
            {
                return;
            }
            else
            {
                landParticles.particleLoop.Stop();

                carroWalkState.displayControl = false;
                carroWalkState.weight         = 0;
                carroWalkState.Stop();

                Debug.Log("CArroWalk == FALSE");
            }
        }
    }
Exemplo n.º 18
0
 static int Play(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DragonBones.AnimationState obj = (DragonBones.AnimationState)ToLua.CheckObject(L, 1, typeof(DragonBones.AnimationState));
         obj.Play();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Exemplo n.º 19
0
    private void CarroDownAnim(bool play)
    {
        if (play)
        {
            if (pipaState != null)
            {
                pipaState = null;
            }
            if (tiroState != null)
            {
                tiroState = null;
            }

            playerLado.animation.lastAnimationState.weight = 0;

            if (carroDownState == null)
            {
                carroDownState = playerLado.animation.FadeIn("6_Rolima(DescendoNoAr)", 0.1f, -1, 8, null, AnimationFadeOutMode.None);
                carroDownState.displayControl = true;
            }
            else
            {
                ActivateCarro(true);

                carroDownState.displayControl = true;
                carroDownState.weight         = 1;
                carroDownState.Play();

                Debug.Log("CArroDown");
            }
            state = State.CarroDown;
        }
        else
        {
            if (carroDownState == null)
            {
                return;
            }
            else
            {
                carroDownState.displayControl = false;
                carroDownState.weight         = 0;
                carroDownState.Stop();
                Debug.Log("CArroDown == FALSE");
            }
        }
    }
Exemplo n.º 20
0
    private void PipaAnim(bool play)
    {
        if (play)
        {
            if (carroDownState != null || carroUpState != null || carroWalkState != null)
            {
                carroDownState = null;
            }
            carroUpState = null; carroWalkState = null;
            if (tiroState != null)
            {
                tiroState = null;
            }
            playerLado.animation.lastAnimationState.weight = 0;
            if (pipaState == null)
            {
                pipaState = playerLado.animation.FadeIn("7_Pipa", 0.1f, -1, 9, null, AnimationFadeOutMode.None);
                pipaState.displayControl = true;
                Debug.Log("PipaState == NULL");
            }
            else
            {
                ActivatePipa(true);

                pipaState.displayControl = true;
                pipaState.weight         = 1;
                pipaState.Play();
            }
            state = State.Pipa;
        }
        else
        {
            if (pipaState == null)
            {
                return;
            }
            else
            {
                pipaState.displayControl = false;
                pipaState.weight         = 0;
                ActivatePipa(false);
                //pipaState = null;
            }
        }
    }
Exemplo n.º 21
0
    private void ArremessandoAnim(bool play)
    {
        if (play)
        {
            if (carroDownState != null || carroUpState != null || carroWalkState != null)
            {
                carroDownState = null;
            }
            carroUpState = null; carroWalkState = null;
            if (pipaState != null)
            {
                pipaState = null;
            }

            playerLado.animation.lastAnimationState.weight = 0;

            if (tiroState == null)
            {
                tiroState                = playerLado.animation.FadeIn("5_Arremessar", 0.1f, -1, 5, null, AnimationFadeOutMode.None);
                tiroState.resetToPose    = true;
                tiroState.displayControl = true;
            }
            else
            {
                tiroState.displayControl = true;
                tiroState.weight         = 1;
                tiroState.Play();
            }

            state = State.Arremessando;
        }
        else
        {
            if (tiroState == null)
            {
                return;
            }
            else
            {
                tiroState.displayControl = false;
                tiroState.Stop();
                tiroState.weight = 0;
            }
        }
    }
Exemplo n.º 22
0
    void UpDog(bool play)
    {
        if (play)
        {
            if (state == State.Up)
            {
                return;
            }

            dogArmature.animation.lastAnimationState.weight = 0;

            dog01Ativo   = false;
            desativaPuff = true;


            if (upState == null)
            {
                upState = dogArmature.animation.FadeIn("1_Subindo(NoAr)", 0.1f, -1, 1, null, AnimationFadeOutMode.Single);
                upState.displayControl = true;
            }
            else
            {
                //if (dog02[0].activeInHierarchy != true) { AtivandoDog02(true); }

                upState.displayControl = true;
                upState.weight         = 1;
                upState.Play();
            }
        }
        else
        {
            if (upState == null)
            {
                return;
            }
            else
            {
                upState.weight         = 0;
                upState.displayControl = false;
                upState.Stop();
            }
        }
    }
Exemplo n.º 23
0
    void WalkDog(bool play)
    {
        if (play)
        {
            if (state == State.Walk)
            {
                return;
            }

            dogArmature.animation.lastAnimationState.weight = 0;

            dog01Ativo   = false;
            desativaPuff = true;

            if (walkState == null)
            {
                walkState = dogArmature.animation.FadeIn("0_Run", 0.1f, -1, 0, null, AnimationFadeOutMode.None);
                walkState.displayControl = true;
            }
            else
            {
                walkState.displayControl = true;
                walkState.weight         = 1;
                walkState.Play();
            }
            state = State.Walk;
        }
        else
        {
            if (walkState == null)
            {
                return;
            }
            else
            {
                walkState.weight         = 0;
                walkState.displayControl = false;
                walkState.Stop();
            }
        }
    }
Exemplo n.º 24
0
    void DownDog(bool play)
    {
        if (play)
        {
            if (state == State.Down)
            {
                return;
            }
            dogArmature.animation.lastAnimationState.weight = 0;

            dog01Ativo   = false;
            desativaPuff = true;

            if (downState == null)
            {
                downState = dogArmature.animation.FadeIn("2_Descendo(NoAr)", 0.1f, -1, 2, null, AnimationFadeOutMode.None);
                downState.displayControl = true;
            }
            else
            {
                downState.displayControl = true;
                downState.weight         = 1;
                downState.Play();
            }
            state = State.Down;
        }
        else
        {
            if (downState == null)
            {
                return;
            }
            else
            {
                downState.displayControl = false;
                downState.weight         = 0;
                downState.Stop();
            }
        }
    }
Exemplo n.º 25
0
    private void AterrisandoAnim(bool play)
    {
        if (play)
        {
            playerLado.animation.lastAnimationState.weight = 0;
            landParticles.PlayLand();

            if (landState == null)
            {
                landState = playerLado.animation.FadeIn("1_Aterrisando", 0.1f, -1, 3, null, AnimationFadeOutMode.Single);
                landState.displayControl = false;
                landState.resetToPose    = true;
            }
            else
            {
                //landState.displayControl = true;
                landState.weight = 1;
                landState.Play();
            }

            state = State.Aterrisando;
        }
        else
        {
            if (landState == null)
            {
                return;
            }
            else
            {
                landState.displayControl = false;
                landState.Stop();
                landState.weight = 0;
            }
        }
    }