Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     MakeFSM();
     player = gameObject;
     SetActorData();
     skm = new SkillMgr();
 }
Example #2
0
    public void Init(int mapId)
    {
        resSvc   = ResSvc.instance;
        audioSvc = AudioSvc.instance;
        timerSvc = TimerSvc.instance;

        stateMgr = this.gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = this.gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();


        mapCfg = resSvc.GetMapCfgData(mapId);
        resSvc.AsyncLoadScene(mapCfg.sceneName, () =>
        {
            GameObject mapObj = GameObject.FindWithTag("MapRoot");
            mapMgr            = mapObj.GetComponent <MapMgr>();
            mapMgr.Init();
            audioSvc.PlayBgMusic(Constants.BGHuangye);

            mapObj.transform.position   = Vector3.zero;
            mapObj.transform.localScale = Vector3.one;

            Camera.main.transform.position         = mapCfg.mainCamPos;
            Camera.main.transform.localEulerAngles = mapCfg.mainCamRote;

            LoadPlayer(mapCfg);

            SetActiveCurrentBatchMonsters();
        });
    }
Example #3
0
        protected virtual bool InitTplData(IActorInitBase initBase)
        {
            var init = initBase as NpcInit;

            if (null == init)
            {
                return(false);
            }

            mNpcData.TemplateId = init.Data.tid;
            if (null == NPCData.Template)
            {
                return(false);
            }

            mNpcData.RoleName = NPCData.Template.name;
            mDeadBodyTime     = mNpcData.Template.deadBodyTime;
            SkillMgr.Init(this, mNpcData);

            mCurrentSpellID    = SkillMgr.getElementByIndex(0).ID;
            mCastSpellDistance = NPCData.Template.distance;
            mSpellType         = (ushort)eSkillTargetType.Enemy;

            BaseGameLogic <INPCLogic> bgLogic = (BaseGameLogic <INPCLogic>)GameLogicManager.Instance.GetGameLogic(eGameLogicType.NPCLogic, (short)mNpcData.Template.logic);

            if (null != bgLogic)
            {
                mLogic = bgLogic.Logic;
            }

            mState = eNPCState.Idle;

            return(true);
        }
Example #4
0
    public void Init(int mapID)
    {
        resSvc   = ResSvc.Instance;
        audioSvc = AudioSvc.Instance;

        //初始化各个管理器
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();

        MapCfg mapData = resSvc.GetMapCfgData(mapID);

        resSvc.AsyncLoadScene(mapData.sceneName, () =>
        {
            audioSvc.PlayBGMusic(Constants.BGHuangYe);

            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init();

            Camera.main.transform.position    = mapData.mainCamPos;
            Camera.main.transform.eulerAngles = mapData.mainCamRote;

            LoadPlayer(mapData);
        });
    }
Example #5
0
    private CSVParser skillList;        // 스킬 리스트
 
    void Awake()
    {
        instance = this;
        skillList = new CSVParser("SkillList");
        skillList.Load();
        SkillInit();
    }
Example #6
0
 // Use this for initialization
 void Start()
 {
     MakeFSM();
     player = gameObject;
     SetActorData();
     skm = new SkillMgr();
 }
Example #7
0
    public void Init(int mapId)
    {
        resSev   = ResSev.Instance;
        audioSev = AudioSev.Instance;

        stateMgr = gameObject.AddComponent <StateMgr>();
        skillMgr = gameObject.AddComponent <SkillMgr>();

        stateMgr.Init();
        skillMgr.Init();

        mapCfg = resSev.GetMapCfgData(mapId);
        resSev.AsyncLoadScene(mapCfg.sceneName, () =>
        {
            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init(this);

            map.transform.localPosition = Vector3.zero;
            map.transform.localScale    = Vector3.one;

            Camera.main.transform.position         = mapCfg.mainCamPos;
            Camera.main.transform.localEulerAngles = mapCfg.mainCamRote;

            LoadPlayer(mapCfg);

            audioSev.PlayBGM(Constans.HuangYeBGM);

            ActiveCurrentBatchMonsters();
        });
    }
Example #8
0
    public void Init(int mapID)
    {
        resSvc   = ResSvc.Instance;
        audioSvc = AudioSvc.Instance;

        //初始化各个管理器
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();


        //加载战场地图
        MapCfgs mapData = resSvc.GetMapCfgData(mapID);

        resSvc.AsyncLoadScene(mapData.sceneName, () =>
        {
            //初始化地图数据
            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init();

            //初始化地图位置和摄像机位置
            map.transform.localPosition            = Vector3.zero;
            map.transform.localScale               = Vector3.zero;
            Camera.main.transform.position         = mapData.mainCamPos;
            Camera.main.transform.localEulerAngles = mapData.mainCamRote;


            LoadPlayer(mapData);
            audioSvc.PlayBGMusic(Constants.BGHuangYe);
            entityPlayer.Idle();
        });
    }
Example #9
0
        };                                                                       //技能释放顺序表
        public bool SelectSpell()
        {
            if (mCurrSpellNode >= mSpellSNodes.Count())
            {
                mCurrSpellNode = 0;
            }

            int          spellId = SkillMgr.getElementByIndex(mSpellSNodes[mCurrSpellNode] - 1).ID;
            ASkillObject skbase  = mSkillMgr.GetSkill(spellId);

            if (skbase == null)
            {
                return(false);
            }

            var sk = skbase as SkillActive;

            if (sk == null)
            {
                return(false);
            }

            if (!sk.SkillCD.IsCoolDown() || !SkillCD.IsCoolDown())
            {
                return(false);
            }

            mCurrentSpellID = spellId;
            CSTable.SkillActiveData skillTplData = sk.Data as CSTable.SkillActiveData;
            mCastSpellDistance = skillTplData.range;

            return(true);
        }
Example #10
0
    public void Init(int mapId)
    {
        mResSvc   = ResSvc.Instance;
        mAudioSvc = AudioSvc.Instance;
        mCfgSvc   = CfgSvc.Instance;

        mSkillMgr = gameObject.AddComponent <SkillMgr>();
        mSkillMgr.Init();
        mStateMgr = gameObject.AddComponent <StateMgr>();
        mStateMgr.Init();


        mAudioSvc.PlayBgAudio(Constant.Audio_BgHuangYe);

        CfgMap cfg = mCfgSvc.GetCfgMap(mapId);

        if (cfg == null)
        {
            Debug.LogError("╪сть╣ьм╪й╖╟э:  " + mapId);
            return;
        }

        mResSvc.AsyncLoadScene(cfg.sceneName, () =>
        {
            GameObject mapGo = GameObject.FindGameObjectWithTag("MapRoot");

            mMapMgr = mapGo.AddComponent <MapMgr>();
            mMapMgr.Init();
            InitScene(cfg);
        });
    }
Example #11
0
 public Role(int player_id) : base(player_id)
 {
     this.equip_mgr = new EquipMgr(this);
     this.skill_mgr = new SkillMgr(this);
     this.buff_mgr  = new BuffMgr(this);
     this.state_mgr = new StateMgr(this);
 }
Example #12
0
    static int Init(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        SkillMgr obj = (SkillMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SkillMgr");

        obj.Init();
        return(0);
    }
Example #13
0
        protected bool InitPlayerData(OffPlayerData pd, RoleCom rc)
        {
            mPlayerData = pd;
            mRoleData   = rc;
            SkillMgr.InitBag(this, pd.skills);

            return(true);
        }
Example #14
0
    static int GetTaskByID(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        SkillMgr  obj  = (SkillMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SkillMgr");
        int       arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
        SkillItem o    = obj.GetTaskByID(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Example #15
0
    static int ComposeSkill(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        SkillMgr  obj  = (SkillMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SkillMgr");
        SkillItem arg0 = (SkillItem)LuaScriptMgr.GetNetObject(L, 2, typeof(SkillItem));
        SkillItem o    = obj.ComposeSkill(arg0);

        LuaScriptMgr.PushObject(L, o);
        return(1);
    }
Example #16
0
    public virtual void Init(BattleMgr battleMgr, StateMgr stateMgr, SkillMgr skillMgr, Controller ctrl, BattleAttribute attribute, Vector3 pos, Orient dir)
    {
        this.battleMgr       = battleMgr;
        this.stateMgr        = stateMgr;
        this.skillMgr        = skillMgr;
        this.controller      = ctrl;
        this.battleAttribute = attribute;

        ctrl.Init(pos, dir);
    }
Example #17
0
        public void RPC_UpCheats(int skillId, byte costType, RPC.RPCForwardInfo fwd)
        {
            RPC.PackageWriter pkg = new RPC.PackageWriter();
            var sk = SkillMgr.GetSkill(skillId);

            if (sk == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NotLearn);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            var sktpl = CSTable.SkillUtil.GetSkillTpl(skillId);

            if (sktpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkill);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            //升级
            if (sk.Level >= PlayerData.RoleDetail.RoleLevel)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.LessRoleLv);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            if (sk.Level >= sk.Data.maxLv)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.MaxLv);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            //下级模板
            var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, sk.Level + 1);

            if (sklvtpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            sbyte result = UpCheats(sklvtpl, costType);

            if (result != (sbyte)eRet_UpSkillLv.Succeed)
            {
                pkg.Write(result);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            sk.Init(sklvtpl.id, (byte)sklvtpl.level);
            sk.SetOwner(this);
            pkg.Write((sbyte)eRet_UpSkillLv.Succeed);
            pkg.DoReturnPlanes2Client(fwd);
        }
Example #18
0
    private HeroModel createHero(int id, int configId, int level, int exp)
    {
        HeroConfig cfg   = _cfgs [configId - 1];
        HeroModel  model = new HeroModel();

        SolaEngine engine   = SolaEngine.getInstance();
        SkillMgr   skillMgr = (SkillMgr)engine.getMgr(typeof(SkillMgr));

        model.setData(cfg, id, level, exp, skillMgr);

        return(model);
    }
Example #19
0
    public void Init(int fbid, Action cb)
    {
        resSvc   = ResSvc.Instance;
        audioSvc = AudioSvc.Instance;

        //初始化各状态管理器
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();

        //加载战斗的地图
        mapCfg = resSvc.GetMapCfg(fbid);
        resSvc.AsyncLoadScene(mapCfg.sceneName, () =>
        {
            //地图初始化
            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init(this);


            audioSvc.PlayBGMusic(Constant.BGOrge, true);

            map.transform.localPosition = Vector3.zero;
            map.transform.localScale    = Vector3.one;

            Camera.main.transform.position         = mapCfg.mainCamPos;
            Camera.main.transform.localEulerAngles = mapCfg.mainCamRote;

            LoadPlayer(mapCfg);
            BattleSys.Instance.SetPlayerCtrlWindow(true);

            //激活第一批怪物
            ActiveCurrentBatchMonster();

            if (cb != null)
            {
                cb();
            }
        });

        PECommon.Log("BattleMgr Init Done");
    }
Example #20
0
    public void Init(int mapid, Action cb = null)
    {
        resSvc   = ResSvc.Instance;
        audioSvc = AudioSvc.Instance;

        // 初始化各个管理器
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();

        // 加载战场地图
        mapCfg = resSvc.GetMapCfgData(mapid);
        resSvc.AsyncLoadScene(mapCfg.sceneName, () => {
            // 初始化地图数据
            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init(this);

            map.transform.localPosition = Vector3.zero;
            map.transform.localScale    = Vector3.one;

            Camera.main.transform.position         = mapCfg.mainCameraPos;
            Camera.main.transform.localEulerAngles = mapCfg.mainCameraRot;

            LoadPlayer(mapCfg);
            entityPlayer.Idle();

            // 激活当前批次的怪物
            ActiveCurrentBatchMonsters();

            if (cb != null)
            {
                cb();
            }

            audioSvc.PlayBGAudio(Constants.BGHuangYe);
        });

        Common.Log("BattleMgr init done");
    }
Example #21
0
    public void Init(int mapId, Action cb = null)
    {
        resSvc   = ResSvc.Instance;
        audioSvc = AudioSvc.Instance;

        // 初始化各管理器
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();
        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();

        // 加载战场地图
        mapCfg = resSvc.GetMapCfg(mapId);
        resSvc.AsyncLoadScene(mapCfg.sceneName, () =>
        {
            // 初始化地图数据
            GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
            mapMgr         = map.GetComponent <MapMgr>();
            mapMgr.Init(this);

            map.transform.localPosition            = Vector3.zero;
            map.transform.localScale               = Vector3.one;
            Camera.main.transform.localPosition    = mapCfg.mainCamPos;
            Camera.main.transform.localEulerAngles = mapCfg.mainCamRote;

            LoadPlayer(mapCfg);
            entitySelfPlayer.Idle();

            // 激活第一批次怪物
            ActiveCurrentBatchMonsters();

            audioSvc.PlayBGMusic(Constants.BGHuangYe);

            if (cb != null)
            {
                cb();
            }
        });
    }
Example #22
0
    public void setData(HeroConfig cfg, int id,
                        int level, int exp, SkillMgr skillMgr)
    {
//		_cfg = cfg;

        _configId = Convert.ToInt32(cfg.id);
        _id       = id;
        _exp      = exp;

        _start   = Convert.ToInt32(cfg.star);
        _bodyImg = "body/body" + _configId;
        _name    = (string)cfg.name;

        _atkBase   = Convert.ToInt32(cfg.atkBase);
        _atkParama = Convert.ToInt32(cfg.atkParam);

        _hpBase   = Convert.ToInt32(cfg.hpBase);
        _hpParama = Convert.ToInt32(cfg.hpParam);

        _spdBase   = Convert.ToInt32(cfg.spdBase);
        _spdParama = Convert.ToInt32(cfg.spdParam);

        _heroSkillModels = new List <HeroSkillModel> ();
        int[] skillInfo = cfg.skillInfo;        //[level,skillId]
        for (int i = 0; i < skillInfo.Length; i = i + 2)
        {
            int needLevel = Convert.ToInt32(skillInfo[i]);
            int skillId   = Convert.ToInt32(skillInfo[i + 1]);

            SkillModel     skillModel = skillMgr.getSkillModel(skillId);
            HeroSkillModel hsModel    = new HeroSkillModel();
            hsModel.setSkillModel(skillModel, needLevel);

            _heroSkillModels.Add(hsModel);
        }

        setLevel(level);
    }
Example #23
0
    public void Init(int characterID, int mapId)
    {
        // TODO: 单个实体独立状态管理
        stateMgr = gameObject.AddComponent <StateMgr>();
        stateMgr.Init();

        skillMgr = gameObject.AddComponent <SkillMgr>();
        skillMgr.Init();

        mapCfg = ConfigSvc.Ins.GetMapCfg(mapId);
        AsyncLoadScene(mapCfg.SceneName, () =>
        {
            var go = GameObject.FindGameObjectWithTag("MapRoot");
            go.transform.localPosition = Vector3.zero;
            go.transform.localScale    = Vector3.one;

            mapMgr = go.GetComponent <MapMgr>();
            mapMgr.Init(this);

            LoadPlayer(characterID, mapCfg);
            selfPlayer.Idle(mapCfg.PlayerBornDir);
        });
    }
Example #24
0
 void Cast(string str, Char owner, params Char[] targets)
 {
     SkillMgr.GetSkill(str).Cast(owner, targets);
 }
Example #25
0
 public void SetSkillMgr(SkillMgr skillMgr)
 {
     this.skillMgr = skillMgr;
 }
Example #26
0
 public BattleMgr()
 {
     m_StateMgr = new StateMgr();
     m_SkillMgr = new SkillMgr();
 }
Example #27
0
 public virtual void SkillAttack(int skillID)
 {
     SkillMgr.SkillAttack(this, skillID);
 }
Example #28
0
 void Cast(string str)
 {
     SkillMgr.GetSkill(str).Cast();
 }
Example #29
0
        public void RPC_UpSkillLv(int skillId, RPC.RPCForwardInfo fwd)
        {
            RPC.PackageWriter pkg = new RPC.PackageWriter();
            var sk    = SkillMgr.GetSkill(skillId);
            var sktpl = CSTable.SkillUtil.GetSkillTpl(skillId);

            if (sktpl == null)
            {
                pkg.Write((sbyte)eRet_UpSkillLv.NoSkill);
                pkg.DoReturnPlanes2Client(fwd);
                return;
            }
            if (sk == null)
            {
                //学习
                var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, 1);
                if (sklvtpl == null)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sbyte result = (sbyte)eRet_UpSkillLv.Failure;
                switch ((CSCommon.eSkillType)sktpl.type)
                {
                case eSkillType.Active:
                    result = UpActiveSkill(sklvtpl);
                    break;

                case eSkillType.Cheats:    //秘籍通过副本开启
                    break;

                case eSkillType.BodyChannel:
                    result = UpBodyChannel(sklvtpl);
                    break;
                }
                if (result != (sbyte)eRet_UpSkillLv.Succeed)
                {
                    pkg.Write(result);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                SkillMgr.CreateSkillToBag(sklvtpl.id, (byte)sklvtpl.level);
            }
            else
            {
                //升级
                if (sk.Level >= PlayerData.RoleDetail.RoleLevel)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.LessRoleLv);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                if (sk.Level >= sk.Data.maxLv)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.MaxLv);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                //下级模板
                var sklvtpl = CSTable.SkillUtil.GetSkillLevelTpl(skillId, sk.Level + 1);
                if (sklvtpl == null)
                {
                    pkg.Write((sbyte)eRet_UpSkillLv.NoSkillLvTpl);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sbyte result = (sbyte)eRet_UpSkillLv.Failure;
                switch ((CSCommon.eSkillType)sktpl.type)
                {
                case eSkillType.Active:
                case eSkillType.Hide:
                    result = UpActiveSkill(sklvtpl);
                    break;

                case eSkillType.Cheats:    //秘籍通过其他方法
                    break;

                case eSkillType.BodyChannel:
                    result = UpBodyChannel(sklvtpl);
                    break;
                }
                if (result != (sbyte)eRet_UpSkillLv.Succeed)
                {
                    pkg.Write(result);
                    pkg.DoReturnPlanes2Client(fwd);
                    return;
                }
                sk.Init(sklvtpl.id, (byte)sklvtpl.level);
                sk.SetOwner(this);
            }
            pkg.Write((sbyte)eRet_UpSkillLv.Succeed);
            pkg.DoReturnPlanes2Client(fwd);
        }
Example #30
0
 public void InitMgrs()
 {
     mSkillMgr = gameObject.AddComponent <SkillMgr>();
     mBuffMgr  = gameObject.AddComponent <BuffMgr>();
 }
Example #31
0
 void Awake()
 {
     Instance      = this;
     skillDict     = new Dictionary <int, SkillItem>();
     SkillListPath = AppConst.SkillListPath;
 }
Example #32
0
 public override void Awake()
 {
     base.Awake();
     mInstance = this;
 }