Ejemplo n.º 1
0
 private void SetLayer(EnvironmentLayer _layer, mg_jr_ParallaxLayer _layerRenderer)
 {
     Assert.NotNull(_layerRenderer);
     if (m_parallaxLayers.ContainsKey(_layer))
     {
         UnityEngine.Object.Destroy(m_parallaxLayers[_layer]);
         m_parallaxLayers[_layer] = null;
     }
     m_parallaxLayers[_layer]        = _layerRenderer;
     _layerRenderer.transform.parent = base.transform;
     if (_layer == EnvironmentLayer.TOP_BORDER && Type == EnvironmentType.CAVE)
     {
         _layerRenderer.DrawingLayer = mg_jr_SpriteDrawingLayers.DrawingLayers.BOTTOM_BORDER;
     }
     else
     {
         _layerRenderer.DrawingLayer = _layer.ConvertToDrawingLayer();
     }
 }
Ejemplo n.º 2
0
        public static mg_jr_Environment CreateEnvironment(EnvironmentType _environmentType, EnvironmentVariant _variant, mg_jr_ScrollingSpeed _scrolling)
        {
            mg_JetpackReboot  active             = MinigameManager.GetActive <mg_JetpackReboot>();
            GameObject        gameObject         = new GameObject("mg_jr_environment_" + _environmentType.ToString().ToLowerInvariant());
            mg_jr_Environment mg_jr_Environment2 = gameObject.AddComponent <mg_jr_Environment>();

            mg_jr_Environment2.Type        = _environmentType;
            mg_jr_Environment2.Variant     = _variant;
            mg_jr_Environment2.m_scrolling = _scrolling;
            foreach (EnvironmentLayer value in Enum.GetValues(typeof(EnvironmentLayer)))
            {
                if (value != EnvironmentLayer.MAX)
                {
                    mg_jr_ParallaxLayer instancedParallaxLayer = active.Resources.GetInstancedParallaxLayer(_environmentType, _variant, value);
                    instancedParallaxLayer.Init(active.GameLogic.TurboPlayArea);
                    Assert.NotNull(instancedParallaxLayer, "There should be a parallaxlayer for every environment and layer combination");
                    mg_jr_Environment2.SetLayer(value, instancedParallaxLayer);
                }
            }
            return(mg_jr_Environment2);
        }