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); } }
private void PartBoxCollected(PartBox partbox) { this.collected = true; if (this.popOnCollect) { this.Pop(); } else { this.Detach(); } }
private void DepositPart(PartBox a_partBox) { var part = GetComponentInChildren <Part>(); if (part == null) { return; } part.GetComponentInChildren <SpriteRenderer>().enabled = true; a_partBox.Deposit(part); }
private void RetrievePart(PartBox a_partBox) { if (a_partBox == null) { return; } var part = a_partBox.Retrieve(); if (part == null) { return; } part.AttachTo(gameObject); }
private void OnCollisionExit2D(Collision2D collision) { m_targetPartBox = null; }
private void OnCollisionEnter2D(Collision2D collision) { m_targetPartBox = collision.gameObject.GetComponent <PartBox>(); }