Exemple #1
0
    // 释放技能aa
    public bool OnCastSkill(sdSkill s)
    {
        if (statePointer == die)
        {
            return(false);
        }

        if (statePointer == null)
        {
            return(false);
        }
        if (!sdGameLevel.instance.AutoMode && _gameActor == sdGameLevel.instance.mainChar)
        {
            JoyStickCastSkill(s);
        }
        if (statePointer.bPassive)
        {
            SwitchSkill(_gameActor, s);
            sdBaseState state = s.GetFirstValidAction();
            SwitchToState(_gameActor, state);
            return(state != null);
        }
        else
        {
            return(statePointer.OnCastSkill(_gameActor, s));
        }
    }
Exemple #2
0
    // 摇杆模式下施放技能时辅助调整方向aa
    protected void JoyStickCastSkill(sdSkill s)
    {
        // 翻滚技能不使用辅助施放aaa
        if (s.id == 1002)
        {
            return;
        }

        // 自动选取朝向上的怪物aaaa
        HeaderProto.ESkillObjType objType = 0;
        if (statePointer.bPassive)
        {
            sdBaseState state = s.GetFirstValidAction();
            objType = (HeaderProto.ESkillObjType)state.stateData["byTargetType"];
        }
        else
        {
            objType = (HeaderProto.ESkillObjType)statePointer.stateData["byTargetType"];
        }

        float xbias = 0.0f;
        float ybias = 0.0f;

        sdGameLevel.instance.mainCharMoveControl(out xbias, out ybias);

        sdActorInterface actor    = null;
        bool             bTurnDir = false;

        // 释放技能前,检查下方向键方向范围内是否有目标,如果有就转向释放技能,没有就不转向aaa
        if (Mathf.Abs(xbias) > 0.1f || Mathf.Abs(ybias) > 0.1f)
        {
            Vector3 worldDir = Vector3.right * xbias + Vector3.forward * ybias;
            worldDir.y = 0.0f;
            worldDir.Normalize();
            actor = sdGameLevel.instance.actorMgr.FindNearestAngle(_gameActor, objType, worldDir, 5.0f, 80.0f);
            if (actor != null)
            {
                //_gameActor._moveVector = worldDir;
                _gameActor.TargetFaceDirection = worldDir;
                bTurnDir = true;
            }
        }

        // 在角色当前方向上寻找最小夹角的目标aaa
        if (!bTurnDir)
        {
            actor = sdGameLevel.instance.actorMgr.FindNearestAngle(_gameActor, objType, _gameActor.GetDirection(), 5.0f, 180.0f);
            if (actor != null)
            {
                Vector3 dir = actor.transform.position - _gameActor.transform.position;
                dir.y = 0;
                dir.Normalize();
                _gameActor.TargetFaceDirection = dir;
            }
        }
    }
Exemple #3
0
    public virtual bool OnCastSkill(sdGameActor _gameActor, sdSkill s)
    {
        if (belongToSkill == s)
        {
            return(OnContinueSkill(_gameActor));
        }
        else
        {
            _gameActor.logicTSM.nextState = s.GetFirstValidAction();
            return(_gameActor.logicTSM.nextState != null);
        }

        return(false);
    }