Beispiel #1
0
    private void DelayExtraMove(int hitActionID)
    {
        SkillAction action     = SkillAction.dataMap[hitActionID];
        MogoMotor   theMotor   = theOwner.motor;
        float       extraSpeed = action.extraSpeed;

        theMotor.SetExrtaSpeed(extraSpeed);
        theMotor.SetMoveDirection(theOwner.Transform.forward);
        TimerHeap.AddTimer <MogoMotor>((uint)action.extraSl, 0, (m) => { m.SetExrtaSpeed(0); }, theMotor);
    }
Beispiel #2
0
        virtual public void ClearSkill(bool remove = false, bool naturalEnd = false)
        {
            TimerHeap.DelTimer(hitTimerID);
            TimerHeap.DelTimer(delayAttackTimerID);
            if (currSpellID != -1)
            {
                if (SkillAction.dataMap.ContainsKey(currHitAction) && remove)
                {
                    RemoveSfx(currHitAction);
                }
                SkillData s;
                if (SkillData.dataMap.TryGetValue(currSpellID, out s) && remove)
                {
                    foreach (var i in s.skillAction)
                    {
                        RemoveSfx(i);
                    }
                }
                currHitAction = -1;
            }
            //for (int i = 0; i < hitTimer.Count; i++)
            //{
            //    TimerHeap.DelTimer(hitTimer[i]);
            //}
            hitTimer.Clear();
            //if (Actor)
            //{
            //Actor.AnimatorStateChanged = null;
            //}
            MogoMotor theMotor = motor;

            if (Transform)
            {
                theMotor.enableStick    = true;
                theMotor.enableRotation = true;
                theMotor.SetExrtaSpeed(0);
                theMotor.SetMoveDirection(Vector3.zero);
            }
            ChangeMotionState(MotionState.IDLE);
            currSpellID = -1;
            //if (this is EntityMyself && naturalEnd)
            //{
            //    (battleManger as PlayerBattleManager).NextCmd();
            //}
        }
Beispiel #3
0
    private void AttackingMove(SkillAction action)
    {
        MogoMotor theMotor = theOwner.motor;

        if (theMotor == null)
        {
            return;
        }
        float extraSpeed = action.extraSpeed;

        if (extraSpeed != 0)
        {
            if (action.extraSt <= 0)
            {
                theMotor.SetExrtaSpeed(extraSpeed);
                theMotor.SetMoveDirection(theOwner.Transform.forward);
                TimerHeap.AddTimer <MogoMotor>((uint)action.extraSl, 0, (m) => { m.SetExrtaSpeed(0); }, theMotor);
            }
            else
            {
                TimerHeap.AddTimer <int>((uint)action.extraSt, 0, DelayExtraMove, action.id);
            }
        }
        else
        {
            theMotor.SetExrtaSpeed(0);
        }

        // 是否允许,在技能过程中使用 摇杆改变方向
        //if (theOwner is EntityMyself)
        //{
        //    theMotor.enableStick = action.enableStick > 0;
        //}

        if (action.teleportDistance > 0 && extraSpeed <= 0)
        {
            Vector3 dst = Vector3.zero;
            dst = theOwner.Transform.position + theOwner.Transform.forward * action.teleportDistance;
            theMotor.TeleportTo(dst);
        }
    }
Beispiel #4
0
    private void FirePerson(GameObject go)
    {
        if (MainUILogicManager.Instance != null)
        {
            MainUILogicManager.Instance.IsAttackable = false;
        }

        MogoWorld.thePlayer.CleanCharging();
        MogoWorld.thePlayer.ClearSkill();
        MogoWorld.thePlayer.ChangeMotionState(MotionState.ROLL);

        MogoMainCamera.Instance.Shake(5, 0.1f);

        ShowGameObject(go);

        go.transform.LookAt(new Vector3(target.transform.position.x, go.transform.position.y, target.transform.position.z));

        // TimerHeap.AddTimer(200, 0, ShowGameObject, go);
        go.transform.position = transform.position;
        float h = go.transform.position.y - targetPosition.y;
        float s = Vector3.Distance(new Vector3(targetPosition.x, go.transform.position.y, targetPosition.z), go.transform.position);

        float vy = Mathf.Sqrt(gravity * Mathf.Pow(s, 2) / (4 * s + 8 * h));
        float vx = 2 * vy;

        Vector3 directionX = (new Vector3(targetPosition.x, go.transform.position.y, targetPosition.z) - go.transform.position).normalized;
        Vector3 directionY = Vector3.up;

        // 玩家MoveTo
        MogoMotor motor = go.GetComponent <MogoMotor>();

        //motor.enableStick = false;
        motor.SetIfFlying(true);
        motor.SetExrtaSpeed(vx);
        motor.verticalSpeed = vy;
        motor.SetMoveDirection(directionX);

        EventDispatcher.TriggerEvent(Events.GearEvent.TrapBegin, gearType);
    }
Beispiel #5
0
        // 状态处理
        public void Processold(EntityParent theOwner, params Object[] args)
        {
            if (theOwner is EntityDummy)
            {
                theOwner.animator.applyRootMotion = true;
            }

            if (args.Length != 1)
            {
                Debug.LogError("error spell id");
                return;
            }
            int         actionID = (int)(args[0]);
            SkillAction action   = SkillAction.dataMap[actionID];
            SkillData   s        = SkillData.dataMap[theOwner.currSpellID];

            // 回调,基于计时器。 在duration 后切换回 idle 状态
            int duration = action.duration;

            if (duration <= 0 && action.action > 0 && s.skillAction.Count == 1)
            {
                //theOwner.AddCallbackInFrames<int, EntityParent>(
                //    (_actionID, _theOwner) =>
                //    {
                //        _theOwner.TriggerUniqEvent<int>(Events.FSMMotionEvent.OnAttackingEnd, _actionID);
                //    },
                //    actionID,
                //    theOwner);
            }
            else if (duration <= 0 && s.skillAction.Count > 1 && theOwner.hitActionIdx >= (s.skillAction.Count - 1))
            {
                if (SkillAction.dataMap[s.skillAction[0]].duration <= 0)
                {
                    theOwner.AddCallbackInFrames <int, EntityParent>(
                        (_actionID, _theOwner) =>
                    {
                        _theOwner.TriggerUniqEvent <int>(Events.FSMMotionEvent.OnAttackingEnd, _actionID);
                    },
                        actionID,
                        theOwner);
                }
            }
            else if (duration > 0 && action.action > 0)
            {
                //theOwner.stateFlag = Mogo.Util.Utils.BitSet(theOwner.stateFlag, 13);//专为旋风斩
                //theOwner.immuneShift = true;
                TimerHeap.AddTimer <int, EntityParent>(
                    (uint)duration,
                    0,
                    (_actionID, _theOwner) =>
                {
                    _theOwner.TriggerUniqEvent <int>(Events.FSMMotionEvent.OnAttackingEnd, _actionID);
                    MogoMotor theMotor = _theOwner.motor;
                    if (_theOwner.Transform)
                    {
                        theMotor.enableStick = true;
                        theMotor.SetExrtaSpeed(0);
                        theMotor.SetMoveDirection(UnityEngine.Vector3.zero);
                    }
                    //_theOwner.stateFlag = Mogo.Util.Utils.BitReset(_theOwner.stateFlag, 13);//专为旋风斩
                    //_theOwner.immuneShift = false;
                    _theOwner.ChangeMotionState(MotionState.IDLE);
                },
                    actionID,
                    theOwner);
            }
            // 回调,基于计时器。 在removeSfxTime 后关闭持久的sfx
            if (action.duration > 0)
            {
                TimerHeap.AddTimer <int, EntityParent>(
                    (uint)action.duration,
                    0,
                    (_actionID, _theOwner) =>
                {
                    _theOwner.RemoveSfx(_actionID);
                },
                    actionID,
                    theOwner);
            }
            theOwner.OnAttacking(actionID, theOwner.Transform.localToWorldMatrix, theOwner.Transform.rotation, theOwner.Transform.forward, theOwner.Transform.position);
        }
Beispiel #6
0
        private void ProcessHit(EntityParent theOwner, int spellID, List <object> args)
        {
            int actionID = (int)args[0];

            UnityEngine.Matrix4x4  ltwm     = (UnityEngine.Matrix4x4)args[1];
            UnityEngine.Quaternion rotation = (UnityEngine.Quaternion)args[2];
            UnityEngine.Vector3    forward  = (UnityEngine.Vector3)args[3];
            UnityEngine.Vector3    position = (UnityEngine.Vector3)args[4];
            if (theOwner is EntityDummy && theOwner.animator != null)
            {
                theOwner.animator.applyRootMotion = true;
            }

            SkillAction action = SkillAction.dataMap[actionID];
            SkillData   s      = SkillData.dataMap[spellID];

            // 回调,基于计时器。 在duration 后切换回 idle 状态
            int duration = action.duration;

            if (duration <= 0 && s.skillAction.Count > 1)// && theOwner.hitActionIdx >= (s.skillAction.Count - 1))
            {
                if (SkillAction.dataMap[s.skillAction[0]].duration <= 0)
                {
                    theOwner.AddCallbackInFrames <int, EntityParent>(
                        (_actionID, _theOwner) =>
                    {
                        _theOwner.TriggerUniqEvent <int>(Events.FSMMotionEvent.OnAttackingEnd, _actionID);
                    },
                        actionID,
                        theOwner);
                }
            }
            else if (duration > 0 && action.action > 0)
            {
                TimerHeap.AddTimer <int, EntityParent>(
                    (uint)duration,
                    0,
                    (_actionID, _theOwner) =>
                {
                    _theOwner.TriggerUniqEvent <int>(Events.FSMMotionEvent.OnAttackingEnd, _actionID);
                    MogoMotor theMotor = _theOwner.motor;
                    if (_theOwner.Transform)
                    {
                        theMotor.enableStick = true;
                        theMotor.SetExrtaSpeed(0);
                        theMotor.SetMoveDirection(UnityEngine.Vector3.zero);
                    }
                    //_theOwner.stateFlag = Mogo.Util.Utils.BitReset(_theOwner.stateFlag, 13);//专为旋风斩
                    //_theOwner.immuneShift = false;
                    _theOwner.ChangeMotionState(MotionState.IDLE);
                },
                    actionID,
                    theOwner);
            }
            // 回调,基于计时器。 在removeSfxTime 后关闭持久的sfx
            if (action.duration > 0)
            {
                TimerHeap.AddTimer <int, EntityParent>(
                    (uint)action.duration,
                    0,
                    (_actionID, _theOwner) =>
                {
                    _theOwner.RemoveSfx(_actionID);
                },
                    actionID,
                    theOwner);
            }
            theOwner.OnAttacking(actionID, ltwm, rotation, forward, position);
        }