private void Awake() { mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); mg_jr_Resources resources = active.Resources; Vector3 position = new Vector3(-16f, active.VisibleWorldBounds.max.y, 0f); base.transform.position = position; m_highestLinePosition = active.VisibleWorldBounds.max.y; m_lowestLinePosition = active.VisibleWorldBounds.min.y; float num = m_highestLinePosition - m_lowestLinePosition; m_lineSpacing = num / (float)(m_maxLineFX - 2); for (int i = 0; i < m_maxLineFX; i++) { GameObject pooledResource = resources.GetPooledResource(mg_jr_ResourceList.GAME_PREFAB_EFFECT_SPEEDLINE); Animator component = pooledResource.GetComponent <Animator>(); Assert.NotNull(component, "SpeedLine needs an animator"); pooledResource.transform.position = new Vector3(base.transform.position.x, m_highestLinePosition - (float)i * m_lineSpacing, 0f); pooledResource.transform.parent = base.transform; SpriteRenderer component2 = pooledResource.GetComponent <SpriteRenderer>(); component2.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.FX_OVERLAY_0); m_speedLines.Add(component); } m_speedLines = m_speedLines.OrderBy((Animator item) => Random.Range(0, m_speedLines.Count)).ToList(); }
private void Start() { m_renderers = GetComponentsInChildren <SpriteRenderer>(); m_miniGame = MinigameManager.GetActive <mg_JetpackReboot>(); m_resources = m_miniGame.Resources; Assert.IsTrue(m_renderers.Length > 0, "This component requires at least one sprite renderer"); }
private void Start() { m_renderer = GetComponentInChildren <SpriteRenderer>(); m_miniGame = MinigameManager.GetActive <mg_JetpackReboot>(); m_resources = m_miniGame.Resources; Assert.NotNull(m_renderer, "This component requires a sprite renderer"); }
public virtual void Explode() { mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); mg_jr_Resources resources = active.Resources; GameObject pooledResource = resources.GetPooledResource(mg_jr_ResourceList.GAME_PREFAB_EFFECT_OBSTACLE_EXPLOSION); Bounds bounds = WidestBounds(); if (bounds.size.x < 1.5f) { pooledResource.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); } SpriteRenderer component = pooledResource.GetComponent <SpriteRenderer>(); Assert.NotNull(component, "Explosion effect must have a spriterenderer"); component.sortingOrder = mg_jr_SpriteDrawingLayers.Instance.SpriteOrder(mg_jr_SpriteDrawingLayers.DrawingLayers.OBSTACLE_0); Vector3 center = component.bounds.center; Vector3 vector = pooledResource.transform.position - center; pooledResource.transform.position = bounds.center + vector; pooledResource.transform.parent = active.GameLogic.transform; if (Random.value >= 0.5f) { active.PlaySFX(mg_jr_Sound.OBSTACLE_EXPLODE_01.ClipName()); } else { active.PlaySFX(mg_jr_Sound.OBSTACLE_EXPLODE_02.ClipName()); } resources.ReturnPooledResource(base.gameObject); }
public mg_jr_Goal(GoalType _goalType, GoalDuration _duration, int[] _objectives, int[] _rewards, string pluralDescription, string singularDescription) { Assert.IsTrue(_objectives.Length == 5, "Must provide exactly " + 5 + " objectives"); Assert.IsTrue(_rewards.Length == 5, "Must provide exactly " + 5 + " rewards"); Type = _goalType; Duration = _duration; m_goalAmounts = _objectives; m_goalRewards = _rewards; this.pluralDescription = pluralDescription; this.singularDescription = singularDescription; CurrentLevel = m_persistenceStrat.LoadLevelFor(this); Progress = m_persistenceStrat.LoadProgresFor(this); m_resources = MinigameManager.GetActive <mg_JetpackReboot>().Resources; }
private void Awake() { m_levelDefinitions = new Dictionary <EnvironmentTypeAndDifficultyID, List <mg_jr_LevelDefinition> >(); mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); m_resources = active.Resources; m_fillLevelsTillX = Camera.main.RightEdgeInWorld() * 2f; m_availableDifficulties = new Dictionary <EnvironmentType, DifficultyRange>(); LoadLevelDeffinitions(Resources.LoadAll <TextAsset>("JetpackReboot/Levels/forest/")); LoadLevelDeffinitions(Resources.LoadAll <TextAsset>("JetpackReboot/Levels/cave/")); LoadLevelDeffinitions(Resources.LoadAll <TextAsset>("JetpackReboot/Levels/town/")); LoadLevelDeffinitions(Resources.LoadAll <TextAsset>("JetpackReboot/Levels/water/")); LoadLevelDeffinitions(Resources.LoadAll <TextAsset>("JetpackReboot/Levels/common/")); Resources.UnloadUnusedAssets(); }
public void DestroyLevel() { mg_jr_Resources resources = MinigameManager.GetActive <mg_JetpackReboot>().Resources; List <Transform> list = new List <Transform>(); foreach (Transform item in base.transform) { list.Add(item); } foreach (Transform item2 in list) { resources.ReturnPooledResource(item2.gameObject); } Object.Destroy(base.gameObject); }
private bool AddLevelToQueueWith(mg_jr_ResourceList _resource, EnvironmentType _environmentType, int _difficulty) { bool result = false; EnvironmentTypeAndDifficultyID key = new EnvironmentTypeAndDifficultyID(_environmentType, _difficulty); List <mg_jr_LevelDefinition> list = m_levelDefinitions[key]; mg_jr_Resources resources = MinigameManager.GetActive <mg_JetpackReboot>().Resources; foreach (mg_jr_LevelDefinition item in list) { if (item.ContainsAtLeastOne(resources.FindXmlNameOfPrefab(_resource))) { LoadLevelAfterExisting(item); result = true; break; } } return(result); }
protected mg_jr_GameObjectFactory() { MiniGame = MinigameManager.GetActive <mg_JetpackReboot>(); Resources = MiniGame.Resources; }