Exemplo n.º 1
0
    public static ViewGridGizmos GetViewGridGizmosFromScene()
    {
        ViewGridGizmos vgg = GameObject.FindObjectOfType <ViewGridGizmos>();

        if (null == vgg)
        {
            GameObject vggGo = new GameObject("vgg");
            vgg = vggGo.AddComponent <ViewGridGizmos>();
        }
        return(vgg);
    }
Exemplo n.º 2
0
    public void EnterScene(string sceneName)
    {
        m_vgg = ViewGridGizmos.GetViewGridGizmosFromScene();

        App.my.gameNetwork.Send(ProtoId.PidLoadSceneComplete);

        App.my.gameNetwork.Add <SceneUnitState>((int)ProtoId.PidSceneUnitState, OnRecvSceneUnitState);
        App.my.gameNetwork.Add <SceneUnitTransform>((int)ProtoId.PidSceneUnitTransform, OnRecvSceneUnitTransform);
        App.my.gameNetwork.Add <SceneUnitMove>((int)ProtoId.PidSceneUnitMove, OnRecvceneUnitMove);
        App.my.gameNetwork.Add <SceneObjectDisappear>((int)ProtoId.PidSceneObjectDisappear, OnSceneObjectDisappear);
        App.my.gameNetwork.Add <SceneUnitSkillAction>((int)ProtoId.PidSceneUnitSkillAction, OnSceneUnitSkillAction);

        App.my.gameNetwork.Add <ViewAllGrids>((int)ProtoId.PidViewAllGrids, (int id, ViewAllGrids msg) =>
        {
            m_vgg.SetAllGrids(msg);
        });
        App.my.gameNetwork.Add <ViewSnapshot>((int)ProtoId.PidViewSnapshot, (int id, ViewSnapshot msg) =>
        {
            m_vgg.SetSnapshot(msg);
        });
        App.my.gameNetwork.Add <ViewSnapshotDiff>((int)ProtoId.PidViewSnapshotDiff, (int id, ViewSnapshotDiff msg) =>
        {
            m_vgg.SetSnapshotDiff(msg);
        });


        {
            foreach (GameObject rootGo in SceneManager.GetActiveScene().GetRootGameObjects())
            {
                if (rootGo.name == "SceneObjects")
                {
                    m_rootSceneObjects = rootGo.transform;
                }
                if (rootGo.name == "Obstacles")
                {
                    m_rootObstacles = rootGo.transform;
                }
            }
        }
    }