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); } } }
void OnTriggerEnter(Collider other) { if (other.tag == "Player") { Pickup.clip = pickupSound; Pickup.Play(); if (WindChimes != null && PartsSounds != null) { PartsSounds.Stop(); } SimpleData.WriteDataPoint("Pickup_Item", "", "", "", "", pickupName); //if(!levelResetter.hasTaggedFirstPart()) //{ // levelResetter.setTaggedFirstPart(true); // levelResetter.startCountdown(); //} //SimpleData.WriteStringToFile("pickups.txt", Time.time + ",PICKUP," + pickupName); ParticleSystem ps = GetComponent <ParticleSystem>(); ParticleSystem.MainModule psMain = GetComponent <ParticleSystem>().main; switch (type) { case PickupType.Item: // Add the item and update the tokens. InventoryController.Add(this, 1); InventoryController.ConvertInventoryToTokens(); // Poke the build button so it can check if it needs to update. //BuildButton.CheckRecipes(); if (gameObject.tag.Equals("rocketBoots")) { ConversationTrigger.AddToken("picked_up_a_boots_piece"); levelResetter.setWhatToBuild("rocketBoots"); } if (gameObject.tag.Equals("sledgehammer")) { ConversationTrigger.AddToken("picked_up_a_sledge_piece"); levelResetter.setWhatToBuild("sledgehammer"); } if (pickupName.Contains("Key1")) { ConversationTrigger.AddToken("picked_up_a_key1_piece"); } if (pickupName.Contains("FFA")) { ConversationTrigger.AddToken("picked_up_a_ffa_piece"); } // 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); //turn aura green and disable pickup trigger if already picked up //this.GetComponent<Collider>().enabled = false; //psMain.startColor = new Color(0f, 255f, 0f, 255f); LoadUtils.IconParenter(this.gameObject); // inc count of item parts and check if done collecting partCounterObj.GetComponent <PartCounter>().incParts(); break; case PickupType.Battery: ConversationTrigger.AddToken("picked_up_a_battery"); // inc count of battery parts and check if done collecting // make sure battery parts UI elements are enabled (won't be for every first battery part pickup) partCounterObj.GetComponent <BatteryCounter>().incParts(); transform.position = new Vector3(-1000f, -1000f, -1000f); //RespawnBattery(); //this.GetComponent<Collider>().enabled = false; //psMain.startColor = new Color(0f, 255f, 0f, 255f); break; case PickupType.Clue: CluePopulator.AddClue(pickupName, clueSprite); ConversationTrigger.AddToken("clue_" + pickupName); ConversationTrigger.AddToken("picked_up_a_clue"); Destroy(gameObject); break; case PickupType.Fuser: transform.position = new Vector3(-1000f, -1000f, -1000f); ConversationTrigger.AddToken("pickedUpFuser"); // gross might have to fix this at some point GameObject.FindWithTag("Player").GetComponent <Fuser>().ActivateFuserFirstLook(); break; } if (autoDelete) { ConversationTrigger.AddToken("autodelete_" + pickupName); } } }