void LanternToDoubleLight(GameObject item) { if (item.GetComponent <Scr_Firefly> () != null && ContainItem.containItemCount < 1) { item.GetComponentInChildren <Animator>().SetBool("WithinLantern", false); item.GetComponentInChildren <Animator>().SetBool("WithinGoal", true); item.GetComponentInChildren <SkinnedMeshRenderer>().enabled = true; item.GetComponentInChildren <ParticleSystem>().Play(); Firefly = item.GetComponent <Scr_Firefly>(); item.GetComponent <SphereCollider> ().enabled = true; item.tag = "ItemLantern"; item.transform.parent = null; Firefly.Goal = Goal; item.transform.position = Goal.position; //Firefly.FireflyToGoal (); Firefly.inGoal = true; Firefly.inDouble = true; doubleLight.counter += 1; doubleLight.DoubleOnOff(); ContainItem.containItemCount += 1; item.transform.rotation = Quaternion.identity; InLantern.RemoveAt(0); Scr_Soundmanager.Sound.Play(DropFirefly[Random.Range(0, DropFirefly.Length)], gameObject, 0.3f, 0.5f, 0.8f, 1.2f); Firefly.PlayMusic(); LanternFade(); } }
void WorldToLantern(GameObject item) { Firefly = item.GetComponent <Scr_Firefly> (); InLantern.Add(ActiveItemLantern); item.GetComponentInChildren <Animator>().SetBool("WithinLantern", true); item.GetComponentInChildren <Animator>().SetBool("WithinGoal", false); item.tag = "Untagged"; item.GetComponentInChildren <SkinnedMeshRenderer>().enabled = false; item.GetComponentInChildren <ParticleSystem>().Stop(); item.transform.parent = Lantern; item.transform.position = Lantern.position; item.GetComponent <SphereCollider>().enabled = false; Firefly.PlayMusic(); if (Firefly.inGoal && ContainItem.containItemCount > 0) { if (Firefly.inDouble) { Firefly.inDouble = false; doubleLight.counter -= 1; doubleLight.DoubleOnOff(); } else { triggerLight.SwitchLightOff(); } // stop swimming as soon as pick up ContainItem.containItemCount -= 1; GetComponent <Scr_PlayerInput> ().DisableSwim(); Firefly.inGoal = false; } Scr_Soundmanager.Sound.Play(PickUpFirefly[Random.Range(0, PickUpFirefly.Length)], gameObject, 0.3f, 0.5f, 0.8f, 1.2f); ActiveItemLantern = null; LanternFade(); }
void LanternToWorld(GameObject item) { Firefly = item.GetComponent <Scr_Firefly> (); item.GetComponentInChildren <Animator>().SetBool("WithinLantern", false); item.GetComponentInChildren <Animator>().SetBool("WithinGoal", false); item.GetComponentInChildren <SkinnedMeshRenderer>().enabled = true; item.GetComponentInChildren <ParticleSystem>().Play(); item.tag = "ItemLantern"; item.GetComponent <SphereCollider>().enabled = true; item.transform.parent = null; item.transform.rotation = Quaternion.identity; InLantern.RemoveAt(0); Scr_Soundmanager.Sound.Play(DropFirefly[Random.Range(0, DropFirefly.Length)], gameObject, 0.3f, 0.5f, 0.8f, 1.2f); Firefly.PlayMusic(); LanternFade(); }