private void HandleSeedPlanting() { // plant the flower that will bloom Instantiate(plant, transform.position, Quaternion.identity); _audioSource.PlayOneShot(_audioClip); //disable the mesh gameObject.GetComponentInChildren <MeshRenderer>().enabled = false; gameObject.GetComponent <SphereCollider>().enabled = false; // update our XP switch ((int)mySeedType) { case 0: ExpManager.UpdateXP(100); break; // flower sprouted case 1: ExpManager.UpdateXP(50); break; // coins sprouted case 2: ExpManager.UpdateXP(1000); break; // crystals sprouted case 3: ExpManager.UpdateXP(2500); break; // tree sprouted case 4: ExpManager.UpdateXP(250); break; // spidertrap sprouted } // destroy the seed Destroy(gameObject, _audioClip.length); }
private void FoundMysteryChest(int itemIndex) { switch (itemIndex) { case 0: { SetPoisoned(false); //potion break; } case 1: { EnableHalo(); //halo break; } case 2: { hasStamina = false; //jug break; } case 3: { //coins levelCoinCount += 1000; break; } case 4: { //gems levelGemCount += 200; break; } case 5: { //XP ExpManager.UpdateXP(100); break; } } // respawn the chests SpawnMysteryChests(); }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { _audioSource.PlayOneShot(_audioClip); EnableThisObject(false); // if this is a collectible trigger differently if (myCollectible != CollectibleType.None) { InteractionManager.SetItemFound((int)myCollectible, true, false); print("Collectible points" + collectiblePoints[(int)myCollectible]); ExpManager.UpdateXP(collectiblePoints[(int)myCollectible]); } else if (myType == ItemType.Chest) { InteractionManager.SetItemFound((int)myMysteryIndex, false, true); ExpManager.UpdateXP(itemPoints[(int)myType]); } else if (myType == ItemType.Shroom) { // if this is a shroom, we also need to pass the number of seeds to add InteractionManager.instance.currentSeedCount += seedCount; InteractionManager.SetItemFound((int)myType, false, false); ExpManager.UpdateXP(itemPoints[(int)myType]); } else if (myType == ItemType.IslandHeart) { // make sure the player has found the mountain blood first if (InteractionManager.foundMountainBlood) { InteractionManager.SetItemFound((int)myType, false, false); ExpManager.UpdateXP(itemPoints[(int)myType]); } } else { InteractionManager.SetItemFound((int)myType, false, false); ExpManager.UpdateXP(itemPoints[(int)myType]); } HandleRemoval(); } }
// Update is called once per frame void Update() { if (ControlFreak2.CF2Input.GetMouseButtonDown(0) && canShoot) { projectile = seedsToLaunch[seedIndex].GetComponent <Rigidbody>(); Rigidbody bulletInstance = Instantiate(projectile, projectileSpawnPoint.position, Quaternion.Euler(new Vector3(0, 0, transform.localEulerAngles.z))) as Rigidbody; bulletInstance.GetComponent <Rigidbody>().AddForce(projectileSpawnPoint.right * projectileVelocity); InteractionManager.instance.currentSeedCount--; ExpManager.UpdateXP(25);//points for each seed thrown, regardless of type canShoot = false; } if (!canShoot) { timeBetweenShotsCounter -= Time.deltaTime; if (timeBetweenShotsCounter <= 0) { canShoot = true; timeBetweenShotsCounter = timeBetweenShots; } } }
public static void SetItemFound(int itemFound, bool isCollectible, bool isChest) { Collectible newCollectible; if (isCollectible) { if (!instance.finalSpecialPanel.activeInHierarchy) { instance.finalSpecialPanel.SetActive(true); } int bonusAmount = 0; switch (itemFound) { case 1: { bonusAmount = 1000; instance.gamePlayer.XP += 1000; ExpManager.UpdateXP(1000); newCollectible = new Collectible("Wooden Horse", 1); instance.gamePlayer.collection.Add(newCollectible); break; } case 2: { bonusAmount = 2500; instance.gamePlayer.XP += 2500; ExpManager.UpdateXP(2500); // found the bear newCollectible = new Collectible("Toy Bear", 2); instance.gamePlayer.collection.Add(newCollectible); break; } case 3: { bonusAmount = 5000; instance.gamePlayer.XP += 5000; ExpManager.UpdateXP(5000); // found the ornament newCollectible = new Collectible("Ornament", 3); instance.gamePlayer.collection.Add(newCollectible); break; } case 4: { bonusAmount = 10000; instance.gamePlayer.XP += 10000; ExpManager.UpdateXP(10000); // found the starfish newCollectible = new Collectible("Starfish", 4); instance.gamePlayer.collection.Add(newCollectible); break; } } instance.specialPoints = instance.specialPoints + bonusAmount; instance.specialText.text = "Special:" + instance.specialPoints; } else { // if this was a chest, then we need to use the itemFound differently if (isChest) { instance.FoundMysteryChest(itemFound); } else { switch (itemFound) { // main level items case 0: { // mountain blood instance.mainItemSprite.sprite = instance.foundSprite; foundMountainBlood = true; instance.gamePlayer.XP += 1000; ExpManager.UpdateXP(1000); instance.gamePlayer.availableLevels[(int)instance.thisLevel].hasCompleted = true; break; } case 1: { instance.gamePlayer.XP += 500; ExpManager.UpdateXP(500); instance.levelBonusItemScore++; instance.bonusItem1Sprite.sprite = instance.foundSprite; instance.foundBonus1 = true; instance.gamePlayer.availableLevels[(int)instance.thisLevel].foundCrystal1 = true; break; } case 2: { instance.gamePlayer.XP += 500; ExpManager.UpdateXP(500); instance.levelBonusItemScore++; instance.bonusItem2Sprite.sprite = instance.foundSprite; instance.foundBonus2 = true; instance.gamePlayer.availableLevels[(int)instance.thisLevel].foundCrystal2 = true; break; } // collectibles case 3: { instance.gamePlayer.XP += 1; ExpManager.UpdateXP(1); instance.levelCoinCount++; break; } case 4: { instance.gamePlayer.XP += 5; ExpManager.UpdateXP(5); instance.levelGemCount++; break; } //case 5: { instance.FoundMysteryChest(itemFound); break; }//found the chest case 6: { instance.SetPoisoned(false); break; } //potion case 7: { break; } //jug case 8: { instance.EnableHalo(); break; } //halo enabled case 9: { instance.EnableThrow(true); break; } // found the shroom case 10: LevelCompleted(); break; default: { break; } } } } }