Beispiel #1
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();
        });
    }
Beispiel #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();
        });
    }
    public void Init(int mapid, Action cb = null)
    {
        TriggerCheck = true;
        IsPauseGame  = false;
        //初始化各管理器
        m_StateMgr.Init();
        m_SkillMgr.Init();

        //加载战场地图
        m_MapCfg = GameEntry.Res.GetMapCfg(mapid);
        //初始化地图数据
        //GameObject map = GameObject.FindGameObjectWithTag("MapRoot");
        m_MapMgr = GameObject.FindObjectOfType <MapMgr>();
        m_MapMgr.Init(this);
        monsterDic.Clear();

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

        LoadPlayer();


        //GameEntry.Sound.PlayUISound(Constants.BGHuangYe);
        if (cb != null)
        {
            cb();
        }
    }
Beispiel #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);
        });
    }
Beispiel #5
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();
        });
    }
Beispiel #6
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);
        }
Beispiel #7
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);
        });
    }
Beispiel #8
0
    static int Init(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        SkillMgr obj = (SkillMgr)LuaScriptMgr.GetUnityObjectSelf(L, 1, "SkillMgr");

        obj.Init();
        return(0);
    }
Beispiel #9
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");
    }
Beispiel #10
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");
    }
Beispiel #11
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();
            }
        });
    }
Beispiel #12
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);
        });
    }
Beispiel #13
0
    public virtual void Init(CreateSceneCreature serverData, CreatureDatabase tableData)
    {
        this.serverData = serverData;
        this.tableData  = tableData;

        initMountPoint();

        _agent = gameObject.AddComponent <NavMeshAgent>();
        _agent.stoppingDistance = GameSetting.StopDistance;
        _agent.speed            = 10f;
        //角速度
        _agent.angularSpeed = float.MaxValue;
        //加速度
        _agent.acceleration = float.MaxValue;
        //阻挡等级为不阻挡
        _agent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
        _rig             = this.gameObject.AddComponent <Rigidbody>();
        _rig.useGravity  = false;
        _rig.isKinematic = true;
        _animator        = gameObject.GetComponent <Animator>();


        _skillMgr.Init(this);
    }