private mg_jr_Environment AddNewEnvironment(mg_jr_EnvironmentID _id) { mg_jr_Environment mg_jr_Environment2 = mg_jr_Environment.CreateEnvironment(_id.Type, _id.Variant, m_speed); mg_jr_Environment2.transform.parent = base.transform; mg_jr_Environment2.gameObject.SetActive(value: false); m_environments.Add(_id, mg_jr_Environment2); return(mg_jr_Environment2); }
private void Start() { mg_jr_GameLogic gameLogic = MinigameManager.GetActive <mg_JetpackReboot>().GameLogic; m_speed = gameLogic.ScrollingSpeed; mg_jr_Environment mg_jr_Environment2 = AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.FOREST, EnvironmentVariant.DEFAULT)); CurrentEnvironment = m_environments[mg_jr_Environment2.Id]; CurrentEnvironment.gameObject.SetActive(value: true); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.FOREST, EnvironmentVariant.NIGHT)); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.CAVE, EnvironmentVariant.DEFAULT)); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.TOWN, EnvironmentVariant.DEFAULT)); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.TOWN, EnvironmentVariant.NIGHT)); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.WATER, EnvironmentVariant.DEFAULT)); AddNewEnvironment(new mg_jr_EnvironmentID(EnvironmentType.WATER, EnvironmentVariant.NIGHT)); }
public void ChangeEnvironment(mg_jr_EnvironmentID _environmentId) { Assert.NotNull(_environmentId, "Environment id can't be null"); if (!(CurrentEnvironment != null) || !(_environmentId == CurrentEnvironment.Id)) { if (m_environments.ContainsKey(_environmentId)) { CurrentEnvironment.gameObject.SetActive(value: false); CurrentEnvironment = m_environments[_environmentId]; CurrentEnvironment.gameObject.SetActive(value: true); } else { DisneyMobile.CoreUnitySystems.Logger.LogWarning(this, "No environment found for id, environment remaina the same"); } } }
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); }