Exemple #1
0
        //判断是否为T4M场景,只要判断有没有高度图raw文件即可
        //public bool IsT4MScene()
        //{
        //    return (m_TerrainData != null);
        //}

        public float GetTerrainHeight(Vector3 pos)
        {
            //if (null != m_TerrainData)
            //{
            return(ActiveScene.GetTerrainPosition(pos).y);
            //}
//
//            return 0;
        }
 void Awake()
 {
     // 加特技
     Games.Scene.ActiveScene activeScene = GameManager.gameManager.ActiveScene;
     if (null != activeScene)
     {
         SceneEffectBehaviourController sebc = activeScene.SceneEffect;
         if (null != sebc)
         {
             m_nEffectNum = (int)(Mathf.Max(transform.localScale.x, transform.localScale.z) / 2.15f);
             if (m_nEffectNum == 0)
             {
                 m_nEffectNum = 1;
             }
             m_nEffectCnt = 0;
             for (int i = 0; i < m_nEffectNum; i++)
             {
                 sebc.PlayEffect(m_nEffectID, EffectStartPlayCallback);
             }
         }
     }
 }
        void Awake()
        {
            //设置当前场景
            if (null == GameManager.gameManager)
            {
                ResourceManager.InstantiateResource("Prefab/Logic/GameManager", "GameManagerObject");
                if (null != GameManager.gameManager)
                {
                    GameManager.gameManager.Init();
                }
                else
                {
                    LogModule.ErrorLog("Create GameManagerInstance failed");
                }
            }

            if (null == PlatformListener.Instance())
            {
                ResourceManager.InstantiateResource("Prefab/Logic/PlatformListener", "PlatformListener");
            }
            //将当前场景SceneLogic放入GameManager暂存
            GameManager.gameManager.SceneLogic = this;

            ResourceManager.InstantiateResource("Prefab/Logic/FingerGestures", "FingerGestures");

            // 将Debug工具挂入场景,如发布正式版,注释掉此行代码
            DebugHelper.CreateDebugHelper();
            CreateAndroidHelper();             //```````````````````
            Singleton <ObjManager> .GetInstance().OnEnterScene();

            // 动态加载场景无法加载SHADER问题
#if UNITY_EDITOR
            GameObject SceneObj = GameObject.Find("Scene");
            if (null != SceneObj && SceneObj.GetComponent <ShaderFix>() == null)
            {
                SceneObj.AddComponent <ShaderFix>();
            }

            TeleportPoint[] Teleports = GameObject.FindObjectsOfType <TeleportPoint>();
            foreach (TeleportPoint curTeleport in Teleports)
            {
                if (curTeleport.gameObject.GetComponent <ShaderFix>() == null)
                {
                    curTeleport.gameObject.AddComponent <ShaderFix>();
                }
            }
#endif
            GameManager.gameManager.ActiveScene.Init();

            //为了防止低端机型在场景切换完成和人物创建完成之间会照到空白的地方,这里先调整一下摄像机的位置
            if (null != Camera.main)
            {
                Vector3 camInitPos = GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterScenePos;
                camInitPos    = ActiveScene.GetTerrainPosition(camInitPos);
                camInitPos.y += 8.0f;
                Camera.main.transform.position = camInitPos;
            }

            //初始化场景通路图
            if (null != GameManager.gameManager.AutoSearch)
            {
                GameManager.gameManager.AutoSearch.InitMapConnectPath();
            }

            //设置是否可处理消息包
            NetWorkLogic.GetMe().CanProcessPacket = true;

            // 广播进入场景消息
            if (GameManager.gameManager.RunningScene != (int)GameDefine_Globe.SCENE_DEFINE.SCENE_LOADINGSCENE)
            {
                Messenger.Broadcast(MessengerConst.OnEnterSceneFinish);
            }
        }