private static IEnumerator SpawnDelay(Vector3 position, float delay) { yield return(new WaitForSeconds(delay)); SnoutCoinSingle.Spawn(position, 0f); yield break; }
public override void OnCollected() { int sandboxStarCollectCount = GameProgress.GetSandboxStarCollectCount(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey); if (sandboxStarCollectCount <= 1) { int num = Singleton <GameConfigurationManager> .Instance.GetValue <int>("star_box_snout_value", "amount"); if (num > 0 && !Singleton <BuildCustomizationLoader> .Instance.IsOdyssey) { GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, true); num = ((!Singleton <DoubleRewardManager> .Instance.HasDoubleReward) ? num : (num * 2)); GameProgress.AddSnoutCoins(num); Singleton <PlayerProgress> .Instance.AddExperience(PlayerProgress.ExperienceType.PartBoxCollectedSandbox); base.ShowXPParticles(); for (int i = 0; i < num; i++) { SnoutCoinSingle.Spawn(base.transform.position - Vector3.forward, 1f * (float)i); } } else if (sandboxStarCollectCount < 1) { GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, false); } } if (!this.isGhost) { GameProgress.AddPartBox(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey); GameProgress.AddSandboxParts(Singleton <GameManager> .Instance.CurrentSceneName, this.partType, this.count, true); if (this.partSprite != null) { this.partSpriteParent.transform.position = base.transform.position - Vector3.forward * 2f; this.partSprite.GetComponent <Renderer>().enabled = true; if (this.partSprite.GetComponent <Animation>() != null && this.collectAnimation != null) { this.partSprite.GetComponent <Animation>().Play(this.collectAnimation.name); } } if (this.tutoPage != null) { if (GameProgress.GetBool(this.TutorialShownKey, false, GameProgress.Location.Local, null)) { this.showTutorial = false; } else { this.showTutorial = true; } } } if (PartBox.onCollected != null) { PartBox.onCollected(); } if (this.onCollect != null) { this.onCollect(this); } }
public static void Spawn(Vector3 position, float delay = 0f) { if (SnoutCoinSingle.snoutCoinSinglePrefab == null) { SnoutCoinSingle.snoutCoinSinglePrefab = Resources.Load <GameObject>("UI/SnoutCoinSingle"); } if (SnoutCoinSingle.snoutCoinSinglePrefab == null) { return; } if (delay > 0.01f) { CoroutineRunner.Instance.StartCoroutine(SnoutCoinSingle.SpawnDelay(position, delay)); return; } UnityEngine.Object.Instantiate <GameObject>(SnoutCoinSingle.snoutCoinSinglePrefab, position, Quaternion.identity); }
public override void OnCollected() { int sandboxStarCollectCount = GameProgress.GetSandboxStarCollectCount(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey); if (sandboxStarCollectCount <= 1) { int num = Singleton <GameConfigurationManager> .Instance.GetValue <int>("star_box_snout_value", "amount"); if (num > 0 && !Singleton <BuildCustomizationLoader> .Instance.IsOdyssey) { GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, true); num = ((!Singleton <DoubleRewardManager> .Instance.HasDoubleReward) ? num : (num * 2)); GameProgress.AddSnoutCoins(num); Singleton <PlayerProgress> .Instance.AddExperience(PlayerProgress.ExperienceType.StarBoxCollectedSandbox); AudioSource win_snd = new GameObject("sbox").AddComponent <AudioSource>(); win_snd.GetComponent <AudioSource>().clip = (AudioClip)Resources.Load("AudioAdd" + Path.DirectorySeparatorChar + "win_snd"); win_snd.GetComponent <AudioSource>().loop = false; win_snd.GetComponent <AudioSource>().volume = 1f; win_snd.GetComponent <AudioSource>().Play(); base.ShowXPParticles(); for (int i = 0; i < num; i++) { SnoutCoinSingle.Spawn(base.transform.position - Vector3.forward, 1f * (float)i); } } else if (sandboxStarCollectCount < 1) { AudioSource win_snd = new GameObject("sbox").AddComponent <AudioSource>(); win_snd.GetComponent <AudioSource>().clip = (AudioClip)Resources.Load("AudioAdd" + Path.DirectorySeparatorChar + "win_snd"); win_snd.GetComponent <AudioSource>().loop = false; win_snd.GetComponent <AudioSource>().volume = 1f; win_snd.GetComponent <AudioSource>().Play(); GameProgress.AddSandboxStar(Singleton <GameManager> .Instance.CurrentSceneName, base.NameKey, false); } } if (StarBox.onCollected != null) { StarBox.onCollected(); } if (this.onCollect != null) { this.onCollect(); } }