コード例 #1
0
ファイル: UIManager.cs プロジェクト: midgithub/notes
        void Init()
        {
            GameObject gUI = GameObject.Find("GameUI");

            if (gUI == null)
            {
                gUI = new GameObject("GameUI");
            }

            CoreEntry.InitUI();
        }
コード例 #2
0
        public bool IsDeath()
        {
            //对战不能死亡
            if (CoreEntry.IsMobaGamePlay())
            {
                return(false);
            }

            if (m_actor == null)
            {
                return(true);
            }
            return(m_actor.IsDeath());
        }
コード例 #3
0
ファイル: MapMgr.cs プロジェクト: midgithub/notes
        private void DoEnterScene()
        {
            LuaTable mapConfig = ConfigManager.Instance.Map.GetMapConfig(m_EnterMapId);

            if (mapConfig == null)
            {
                return;
            }
            m_EnterMapType = mapConfig.Get <int>("monsterType");
            m_lastMapType  = m_curMapType;
            m_curMapType   = GetMapType(mapConfig.Get <int>("type"));

            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_BEGIN_LOADSCENE, null);

            MainRole.Instance.mapid = m_EnterMapId;
            //CoreEntry.SetGamePage(CoreEntry.GAME_PAGE.GAME);
            CoreEntry.CoreInit();
            CoreEntry.enterFight();
            CoreEntry.InFightScene     = false;
            MapMgr.Instance.InMainCity = true;


            LoadingWindowImpl.LoadScene(mapConfig.Get <string>("res"));
        }
コード例 #4
0
        public float moveToTargetBySpeed(Transform targetTransform, float speed = 10)
        {
            if (CoreEntry.IsMobaGamePlay())
            {
                speed = 22;
            }

            float   time;
            Vector3 dist    = targetTransform.position - mLastCameraPosition;
            float   distLen = dist.magnitude;

            if (speed < 0.001)
            {
                time = 0.001f;
            }
            else
            {
                time = distLen / speed;
            }

            moveToTarget(targetTransform, time);

            return(time);
        }
コード例 #5
0
        public void OnLevelWasLoaded(int level)
        {
            Scene loadedScene = SceneManager.GetActiveScene();

            if (!loadedScene.name.Equals("loadingscene") && !loadedScene.name.Equals("LoginOut"))
            {
                int curSceneId = MapMgr.Instance.GetCurSceneID();     //第一个场景ID

                if (curSceneId > 0)
                {
                    CoreEntry.InitUI();

                    if (ModuleServer.MS.GSkillCastMgr != null)
                    {
                        ModuleServer.MS.GSkillCastMgr.Enable();
                    }

                    MainPanelMgr.Instance.uiCamera.cullingMask = 1 << LayerMask.NameToLayer("UI");

                    LoadSceneObjects(curSceneId);
                    CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_AFTER_LOADSCENE, EventParameter.Get(curSceneId));
                }
            }
        }
コード例 #6
0
        public behaviac.EBTStatus PlayerAutoMove()
        {
            if (!CoreEntry.GameStart || (CoreEntry.IsMobaGamePlay()))
            {
                return(behaviac.EBTStatus.BT_FAILURE);
            }

            //if (CoreEntry.gGameMgr.AutoFight)
            //{
            //    if (CoreEntry.gActorMgr.MainPlayer.m_bUseAI == false)
            //    {
            //        return behaviac.EBTStatus.BT_FAILURE;
            //    }
            //}


            ActorObj playerObj = m_actor;

            float distance = 0.0f;

            m_AttackObj = m_actor.GetAttackObj();
            if (m_AttackObj)
            {
                distance = Vector3.Distance(m_transform.position, m_AttackObj.transform.position);
                if (distance < fMonsterMinDist)
                {
                    playerObj.StopMove(true);

                    return(behaviac.EBTStatus.BT_SUCCESS);
                }
            }

            if (!ArenaMgr.Instance.IsArenaFight)
            {
                if (m_AttackObj)
                {
                    playerObj.StopMove(true);

                    nSkillIndex = 0;

                    return(behaviac.EBTStatus.BT_FAILURE);
                }
            }
            else
            {
                if (m_AttackObj)
                {
                    m_AutoNavPos = m_AttackObj.transform.position;
                }
            }

            //主角寻路超时设定,防止后面停止不动
            if (IsRunningTimeOut())
            {
                Debug.LogWarning("Main Player is running time out...");
                return(behaviac.EBTStatus.BT_FAILURE);
            }

            //目标没改变,且run状态,不处理
            if (m_movePos.Equals(m_AutoNavPos) && m_actor.curActorState == ACTOR_STATE.AS_RUN)
            {
                return(behaviac.EBTStatus.BT_RUNNING);
            }

            m_actor.FaceTo(m_AutoNavPos);

            if (m_actorObject.MoveToPos(m_AutoNavPos))
            {
                m_movePos = m_AutoNavPos;
            }

            return(behaviac.EBTStatus.BT_RUNNING);
        }
コード例 #7
0
        //private GameObject m_cylinderObj = null;

        public override void OnEnter(ActorObj actorBase)
        {
            m_state = ACTOR_STATE.AS_ENTER;

            m_actor = actorBase;

            string enterAction = m_actor.enterAction;


            ////删除挂点
            //Transform cylinderTransform = this.gameObject.transform.FindChild("Cylinder002");
            //if (cylinderTransform != null)
            //{
            //    m_cylinderObj = cylinderTransform.gameObject;
            //    m_cylinderObj.active = true;
            //}

            float endTime = m_actor.GetActionLength(enterAction);

            //if (endTime > 0.5f)
            //{
            //    endTime = endTime - 0.2f;
            //}


            if (enterAction == "stand")
            {
                endTime = 0.5f;
            }


            if (endTime == 0)
            {
                endTime = 0.5f;
            }


            m_actor.PlayAction(enterAction, false);

            //播放特效
            string enterEfx = "";// m_actor.actorCreatureDisplayDesc.enterEfx;

            if (CoreEntry.IsMobaGamePlay() == false && enterEfx != "")
            {
                if (m_actor.mActorType == ActorType.AT_MONSTER || m_actor.mActorType == ActorType.AT_MECHANICS)
                {
                    enterEfx = "Effect/skill/remain/fx_xiaobingchuxian01";
                }
                if (m_actor.mActorType == ActorType.AT_BOSS)
                {
                    enterEfx = "Effect/skill/remain/fx_bosschuxian";
                }

                if (enterEfx.Length > 0)
                {
                    GameObject efxObj = CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx);
                    //GameObject efxObj = (GameObject)Instantiate(CoreEntry.gResLoader.LoadResource(enterEfx));//CoreEntry.gGameObjPoolMgr.InstantiateEffect(enterEfx);
                    if (efxObj != null)
                    {
                        SceneEfxPool efx = null;
                        if (efxObj)
                        {
                            efx = efxObj.GetComponent <SceneEfxPool>();
                        }
                        if (efx == null)
                        {
                            efx = efxObj.AddComponent <SceneEfxPool>();
                        }
                        efx.Init(m_actor.transform.position, endTime);
                    }
                }
            }



            //无敌状态,受击没反映
            float immuneTime = endTime;

            //if (m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime > 0)
            //{
            //    immuneTime = m_actor.actorCreatureDisplayDesc.enterImmuneKeepTime;
            //}
            m_actor.RecoverHealth(immuneTime);

            //硬直状态,自己不能切换状态
            m_isNonControl = true;

            Invoke("EndEnterState", endTime);

            //去掉碰撞
            m_actor.CancelCollider();
        }