Example #1
0
 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();
     }
 }
Example #2
0
    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();
    }
Example #3
0
    // Über OnTriggerEnter checken wir, ob sich ein getagtes Item für Hand oder Laterne in Reichweite befindet.
    // In dem Fall wird dieses Item als ActiveItem gespeichert.
    // Auf dieses aktive Item greifen wir zu wenn wir dann eine Taste drücken.
    // In OnTriggerExit wird das ActiveItem wieder null gesetzt und es gibt nichts mehr zum Aufnehmen.

    void OnTriggerStay(Collider other)
    {
        if (other.tag == "ItemHand")
        {
            ActiveItemHand = other.gameObject;
            Jellyfish      = other.GetComponent <Scr_Jellyfish>();
        }
        else if (other.tag == "ItemLantern")
        {
            ActiveItemLantern = other.gameObject;
            Firefly           = other.GetComponent <Scr_Firefly>();
        }
        else if (other.tag == "TriggerJellyfish")
        {
            inTriggerJelly = true;
            Goal           = other.transform;
            triggerLight   = other.GetComponentInChildren <Scr_TriggerLight>();
            ContainItem    = other.GetComponent <Scr_ContainItem> ();
        }
        else if (other.tag == "TriggerFirefly")
        {
            inTriggerFirefly = true;
            Goal             = other.transform;
            triggerLight     = other.GetComponentInChildren <Scr_TriggerLight>();
            ContainItem      = other.GetComponent <Scr_ContainItem> ();
        }
        else if (other.tag == "TriggerDoubleFirefly")
        {
            inDoubleTrigger = true;
            Goal            = other.transform;
            triggerLight    = other.GetComponentInParent <Scr_TriggerLight>();
            doubleLight     = other.GetComponentInParent <Scr_DoubleLightSource>();
            ContainItem     = other.GetComponent <Scr_ContainItem> ();
        }

        else if (other.tag == "Sun" && endMusicOn == false)
        {
            endTime = Time.time;

            GetComponent <Scr_PlayerInput>().TurnOff();
            Sun.GetComponent <Scr_Sunrise>().enabled = true;
            //camPlayer.tag = "Untagged";
            //camSun.tag = "MainCamera";
            camPlayer.enabled    = false;
            camSun.enabled       = true;
            lanternImage.enabled = false;
            changeEnd.TransitionTo(1f);
            Scr_Soundmanager.Sound.Play(endTrack, gameObject, 0.8f, 0.8f, 1f, 1f, 1000f, 0f);
            endMusicOn = true;
        }
    }
Example #4
0
 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();
 }