Example #1
0
        public override void Enter(GameObject gameObject, AnimatorHandler animatorHandler, StateContex contex)
        {
            string animation = contex.weapon.GetStandAnimationName();

            if (animation != string.Empty)
            {
                animatorHandler.animator.SetInteger(DTSAnimation.POSE_PARAM, DTSAnimation.ANIMATION_STATE_STAND);
                animatorHandler.PlayAnimation(animation, 0);
                animatorHandler.PlayAnimation(animation, 1);
            }
        }
        public override void Enter(GameObject gameObject, AnimatorHandler animatorHandler, StateContex contex)
        {
            string animation = contex.weapon.GetCrouchAnimationName();

            if (animation != string.Empty)
            {
                // 设置角色姿态 为 蹲下
                animatorHandler.animator.SetInteger(DTSAnimation.POSE_PARAM, DTSAnimation.ANIMATION_STATE_CROUCH);
                // 播放使用 该武器类型 的 站立动画
                animatorHandler.PlayAnimation(animation, 0);
                animatorHandler.PlayAnimation(animation, 1);
            }
        }
Example #3
0
 public override void GoToDeath()
 {
     if (!Death())
     {
         return;
     }
     SetHp(0);
     isAlive = false;
     animatorHandler.animator.SetInteger(DTSAnimation.POSE_PARAM, 0);
     animatorHandler.animator.SetInteger(DTSAnimation.WEAPON_PARAM, 0);
     animatorHandler.PlayAnimation(DTSAnimation.DEATH_1, 0);
     animatorHandler.PlayAnimation(DTSAnimation.DEATH_1, 1);
     EventMgr.Instance.EventTrigger(EventName.PLAYER_DEATH, userID);
 }
Example #4
0
        public void ReloadBullet(AnimatorHandler animatorHandler)
        {
            if (BulletCountSecond.val == 0)
            {
                MusicMgr.Instance.PlaySound("kake");
                nextAllowUseSkillTime = Time.time * 1000;
                reload.ClearCD();
                return;
            }

            if (BulletCountFirstFull == BulletCountFirst.val)
            {
                return;
            }

            MusicMgr.Instance.PlaySound("reload");
            animatorHandler.PlayAnimation(DTSAnimation.HEAVY_RELOAD, 1);

            MonoMgr.Instance.StartDelayEvent(reload.LockTime, () => {
                int bulletCount = BulletCountFirstFull - BulletCountFirst.val;
                bulletCount     = Math.Min(bulletCount, BulletCountSecond.val);

                BulletCountFirst.val  += bulletCount;
                BulletCountSecond.val -= bulletCount;
            });
        }
        public override void Enter(GameObject gameObject, AnimatorHandler animatorHandler, StateContex contex)
        {
            string animation = contex.weapon.GetDumpAnimationName();

            if (animation != string.Empty)
            {
                // 设置角色姿态 为 站立
                animatorHandler.animator.SetInteger(DTSAnimation.POSE_PARAM, DTSAnimation.ANIMATION_STATE_STAND);

                // 播放使用 该武器类型 的 跳跃 动画
                animatorHandler.PlayAnimation(animation, 0);
                gameObject.GetComponent <Rigidbody>().AddForce(gameObject.transform.up * force);

                preState = contex.preState;

                dumpTime = Time.time * 1000;
                MemeryCacheMgr.Instance.Set(gameObject.name.ToString() + "#" + DTSKeys.DROP_DOWN, false);
            }
        }
        public override SoldierStateBase NextState(GameObject gameObject, AnimatorHandler animatorHandler, StateContex contex)
        {
            try
            {
                bool inTheFloor = (bool)MemeryCacheMgr.Instance.Get(gameObject.name.ToString() + "#" + DTSKeys.DROP_DOWN);

                if (inTheFloor && Time.time * 1000 - dumpTime > 500)
                {
                    string animation = contex.weapon.GetDropDownAnimationName();
                    animatorHandler.PlayAnimation(animation, 0);
                    preState.Enter(gameObject, animatorHandler, contex);
                    return(preState);
                }
                else
                {
                    return(soldierStateJump);
                }
            }
            catch (Exception ex)
            {
                Debug.Log("in the floor boolean parse fail. " + ex.ToString());
                return(preState);
            }
        }