Пример #1
0
        public void Process(EntityParent theOwner, params object[] args)
        {
            int act = (int)ActionConstants.die;

            theOwner.ApplyRootMotion(true);
            string actName = theOwner.CurrActStateName();//当前动画的名称

            if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hit_air]) || actName.EndsWith("getup"))
            {
                act = (int)ActionConstants.die_knock_down;
                theOwner.SetAction(act);
            }
            else if (actName.EndsWith(PlayerActionName.actionOfNames[(int)ActionConstants.hited_ground]) || actName.EndsWith("knockout"))
            {
                act = (int)ActionConstants.die;
                theOwner.SetAction(act);
            }
            else
            {
            }
            theOwner.SetSpeed(0);
            EventDispatch.TriggerEvent(Event.LogicSoundEvent.OnHitYelling, theOwner as EntityParent, act);
            if (theOwner is EntityMyself && theOwner.motor)
            {
                theOwner.motor.enableStick = false;
            }
        }
Пример #2
0
        /// <summary>
        /// 发出攻击
        /// </summary>
        /// <param name="hitActionId"></param>
        /// <param name="itwm"></param>
        /// <param name="rotation"></param>
        /// <param name="forward"></param>
        /// <param name="position"></param>
        public void OnAttacking(int hitActionId, Matrix4x4 ltwm, Quaternion rotation, Vector3 forward, Vector3 position)
        {
            SkillAction action = SkillAction.dataMap[hitActionId];

            if (action.removeCollider == 1)
            {
            }
            //动画动作
            int act = action.action;

            if (act > 0)
            {
                if (PlayerActionNames.animatorNames.ContainsKey(act))
                {
                    theOwner.skillActName = PlayerActionNames.animatorNames[act];
                }
                else
                {
                    Debug.LogWarning("找不到动作id");
                    theOwner.skillActName = "";
                }
                theOwner.SetAction(act);
            }
            AttackingFx(action);
            AttackingMove(action);
            AttackBuff(action);

            List <object> args = new List <object>();

            args.Add(ltwm);
            args.Add(rotation);
            args.Add(forward);
            args.Add(position);
            theOwner.delayAttackTimerID = TimerHeap.AddTimer((uint)(action.actionBeginDuration / theOwner.aiRate), 0, DelayAttack, hitActionId, args);
        }
Пример #3
0
        // 状态处理
        public void Process(EntityParent theOwner, params object[] args)
        {
            Debug.Log("Idle");
            // 播放 idle 动画
            if (theOwner == null)
            {
                return;
            }
            if (theOwner.CanMove() && theOwner.motor != null)
            {
                theOwner.motor.enableStick = true;
            }
            GameMotor theMotor = theOwner.motor;

            if (theOwner is EntityBeast)
            {
                theOwner.ApplyRootMotion(false);
            }
            // 设置速度
            if (theMotor != null)
            {
                theMotor.SetSpeed(0.0f);
                theMotor.SetExtraSpeed(0f);
            }
            if (theOwner.charging)
            {
                return;
            }
            if (theOwner is EntityPlayer && GameWorld.isInTown)
            {
                theOwner.SetAction(-1);
            }
            else
            {
                theOwner.SetAction(0);
            }
            theOwner.SetActionByStateFlagInIdleState();
        }