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;
            }
        }
    }
Beispiel #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;
            }
        }
    }
Beispiel #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();
            }
        }
    }
 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();
         }
     }
 }
Beispiel #8
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;
            }
        }
    }
Beispiel #9
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();
            }
        }
    }
 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;
         }
     }
 }
Beispiel #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();
            }
        }
    }
Beispiel #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();
            }
        }
    }
Beispiel #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;
            }
        }
    }
Beispiel #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;
            }
        }
    }
Beispiel #15
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");
            }
        }
    }
Beispiel #16
0
 static int Stop(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         DragonBones.AnimationState obj = (DragonBones.AnimationState)ToLua.CheckObject(L, 1, typeof(DragonBones.AnimationState));
         obj.Stop();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #17
0
    void PlayUp()
    {
        if (curSwitch == null)
        {
            return;
        }

        var openState = uac.animation.FadeIn("cap_open", 0f, 1, 0);
        var upState   = uac.animation.FadeIn("rod_up", 0f, 1, 1);

        // 设置移动动画
        rodMoveState             = uac.animation.FadeIn("rod_move", 0f, 1, 2, "moveGroup");
        rodMoveState.resetToPose = false;
        rodMoveState.Stop();
        rodMoveState.currentTime = curRodPosPerc * rodMoveState.totalTime;
    }
Beispiel #18
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");
            }
        }
    }
Beispiel #19
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;
            }
        }
    }
    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();
            }
        }
    }
    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();
            }
        }
    }
    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();
            }
        }
    }
    void IdleDog(bool play)
    {
        if (play)
        {
            if (state != State.Idle)
            {
                dogArmature.animation.lastAnimationState.weight = 0;

                dog01Ativo   = true;
                desativaPuff = true;
                dogArmature.animation.lastAnimationState.Stop();
                if (idleState == null)
                {
                    //idleState = dogArmature.animation.FadeIn("4_Idle", 0.1f, -1, 3, 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.weight         = 0;
                idleState.displayControl = false;
                idleState.Stop();
            }
        }
    }
Beispiel #24
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;
            }
        }
    }
        /**
         * @language zh_CN
         * @beta
         * 通过动画配置来播放动画。
         * @param animationConfig 动画配置。
         * @returns 对应的动画状态。
         * @see DragonBones.AnimationConfig
         * @see DragonBones.AnimationState
         * @version DragonBones 5.0
         */
        public AnimationState PlayConfig(AnimationConfig animationConfig)
        {
            if (animationConfig == null)
            {
                DragonBones.Assert(false, DragonBones.ARGUMENT_ERROR);
                return(null);
            }

            var animationName = !string.IsNullOrEmpty(animationConfig.animationName) ? animationConfig.animationName : animationConfig.name;
            var animationData = _animations.ContainsKey(animationName) ? _animations[animationName] : null;

            if (animationData == null)
            {
                DragonBones.Assert(false,
                                   "Non-existent animation.\n" +
                                   "DragonBones name: " + _armature.armatureData.parent.name +
                                   " Armature name: " + _armature.name +
                                   " Animation name: " + animationName
                                   );

                return(null);
            }

            _isPlaying = true;

            if (animationConfig.playTimes < 0)
            {
                animationConfig.playTimes = (int)animationData.playTimes;
            }

            if (animationConfig.fadeInTime < 0.0f || float.IsNaN(animationConfig.fadeInTime))
            {
                if (_lastAnimationState != null)
                {
                    animationConfig.fadeInTime = animationData.fadeInTime;
                }
                else
                {
                    animationConfig.fadeInTime = 0.0f;
                }
            }

            if (animationConfig.fadeOutTime < 0.0f || float.IsNaN(animationConfig.fadeOutTime))
            {
                animationConfig.fadeOutTime = animationConfig.fadeInTime;
            }

            if (animationConfig.timeScale <= -100.0f || float.IsNaN(animationConfig.timeScale)) //
            {
                animationConfig.timeScale = 1.0f / animationData.scale;
            }

            if (animationData.duration > 0.0f)
            {
                if (float.IsNaN(animationConfig.position))
                {
                    animationConfig.position = 0.0f;
                }
                else if (animationConfig.position < 0.0f)
                {
                    animationConfig.position %= animationData.duration;
                    animationConfig.position  = animationData.duration - animationConfig.position;
                }
                else if (animationConfig.position == animationData.duration)
                {
                    animationConfig.position -= 0.001f;
                }
                else if (animationConfig.position > animationData.duration)
                {
                    animationConfig.position %= animationData.duration;
                }

                if (animationConfig.position + animationConfig.duration > animationData.duration)
                {
                    animationConfig.duration = animationData.duration - animationConfig.position;
                }
            }
            else
            {
                animationConfig.position = 0.0f;
                animationConfig.duration = -1.0f;
            }

            var isStop = animationConfig.duration == 0.0f;

            if (isStop)
            {
                animationConfig.playTimes  = 1;
                animationConfig.duration   = -1.0f;
                animationConfig.fadeInTime = 0.0f;
            }

            _fadeOut(animationConfig);

            _lastAnimationState = BaseObject.BorrowObject <AnimationState>();
            _lastAnimationState._init(_armature, animationData, animationConfig);
            _animationStates.Add(_lastAnimationState);
            _animationStateDirty = true;
            _cacheFrameIndex     = -1;

            if (_animationStates.Count > 1)
            {
                _animationStates.Sort(_sortAnimationState);
            }

            // Child armature play same name animation.
            var slots = _armature.GetSlots();

            for (int i = 0, l = slots.Count; i < l; ++i)
            {
                var childArmature = slots[i].childArmature;
                if (
                    childArmature != null && childArmature.inheritAnimation &&
                    childArmature.animation.HasAnimation(animationName) &&
                    childArmature.animation.GetState(animationName) == null
                    )
                {
                    childArmature.animation.FadeIn(animationName); //
                }
            }

            if (animationConfig.fadeInTime <= 0.0f) // Blend animation state, update armature.
            {
                _armature.AdvanceTime(0.0f);
            }

            if (isStop)
            {
                _lastAnimationState.Stop();
            }

            return(_lastAnimationState);
        }