Пример #1
0
    public void CastSkill(int skillIndex = -1)
    {
        var roleGameOE = RoleMgr.GetInstance().GetMainRole();
        var roleInfo   = roleGameOE.GetComponent <RoleInfo>();
        var skillID    = SkillManager.GetInstance().GetSkillIDByIndex(skillIndex);

        string assetPath      = ResPath.GetRoleSkillResPath(skillID);
        bool   isNormalAttack = skillIndex == -1;//普通攻击

        if (!isNormalAttack)
        {
            SkillManager.GetInstance().ResetCombo();//使用非普攻技能时就重置连击索引
        }
        var uid = SceneMgr.Instance.EntityManager.GetComponentData <UID>(roleGameOE.Entity);
        Action <TimelineInfo.Event> afterAdd = null;

        if (isNormalAttack)
        {
            //普攻的话增加连击索引
            afterAdd = (TimelineInfo.Event e) =>
            {
                if (e == TimelineInfo.Event.AfterAdd)
                {
                    SkillManager.GetInstance().IncreaseCombo();
                }
            };
        }
        var timelineInfo = new TimelineInfo {
            ResPath = assetPath, Owner = roleGameOE.Entity, StateChange = afterAdd
        };

        TimelineManager.GetInstance().AddTimeline(uid.Value, timelineInfo, SceneMgr.Instance.EntityManager);
    }
Пример #2
0
    public string GetSkillResPath(int skillID)
    {
        string assetPath;
        int    scene_obj_type = GetSceneObjTypeBySkillID(skillID);

        if (scene_obj_type == (int)SceneObjectType.Role)
        {
            assetPath = ResPath.GetRoleSkillResPath(skillID);
        }
        else if (scene_obj_type == (int)SceneObjectType.Monster)
        {
            assetPath = ResPath.GetMonsterSkillResPath(skillID);
        }
        else
        {
            assetPath = "";
        }
        return(assetPath);
    }