void OnTriggerEnter(Collider other) { if (other.tag == "Player") { AudioSource.PlayClipAtPoint(pickupClip, transform.position); SimpleData.WriteStringToFile("pickups.txt", Time.time + ",PICKUP," + pickupName); switch (type) { case PickupType.Item: // Add the item and update the tokens. InventoryController.Add(this, 1); InventoryController.ConvertInventoryToTokens(); // Object still needs to exist for the icon to work. // Silly, but let's just shove it into a corner and forget about it. // Also parents to the scene manager object so it rejects deletion as much as possible. transform.position = new Vector3(-1000f, -1000f, -1000f); LoadUtils.IconParenter(this.gameObject); break; case PickupType.Battery: BatterySystem.AddPower(2); BatterySystem.PowerToTokens(); RespawnBattery(); break; case PickupType.Clue: CluePopulator.AddClue(pickupName, clueSprite); ConversationTrigger.AddToken("clue_" + pickupName); Destroy(gameObject); break; } if (autoDelete) { ConversationTrigger.AddToken("autodelete_" + pickupName); } } }