Example #1
0
 // Start is called before the first frame update
 void Start()
 {
     lm    = FindObjectOfType <LevelManager>();
     state = 0;
     BlueBook.SetActive(false);
     YellowBook.SetActive(false);
     DeadBook.SetActive(false);
     Magic.SetActive(false);
     DarkBackground2.SetActive(false);
     m_Audio = GetComponent <AudioSource>();
 }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        m_Audio = GetComponent <AudioSource>();
        lm      = FindObjectOfType <LevelManager>();
        string[] LFArr = { "C1", "T1", "H", "U1", "L", "U2" };
        string[] LArr  = { "E1", "X", "C2", "E2", "P", "T2", "E3", "D" };
        string[] LDArr = { "E1D", "XD", "C2D", "E2D", "PD", "T2D", "E3D", "DD" };
        LettersFixed = new List <GameObject>();
        Letters      = new List <GameObject>();
        LettersDark  = new List <GameObject>();
        state        = 0;
        BlueBook.SetActive(false);
        YellowBook.SetActive(false);
        DeadBook.SetActive(false);
        TED.SetActive(false);
        DarkBackground.SetActive(false);
        //Carpet.SetActive(false);
        //Light.SetActive(false);
        //DarkBackground2.SetActive(false);
        for (int i = 2; i < 8; i++)
        {
            flag += (1 << i);
        }
        for (int i = 2; i < 11; i++)
        {
            failflag += (1 << i);
        }

        foreach (string name in LDArr)
        {
            GameObject obj = GameObject.Find(name);
            LettersDark.Add(obj);
            obj.SetActive(false);
        }
        foreach (string name in LFArr)
        {
            GameObject obj = GameObject.Find(name);
            LettersFixed.Add(obj);
            obj.SetActive(false);
        }
        foreach (string name in LArr)
        {
            GameObject obj = GameObject.Find(name);
            Letters.Add(obj);
            obj.SetActive(false);
        }
    }
Example #3
0
 // Start is called before the first frame update
 void Start()
 {
     lm    = FindObjectOfType <LevelManager>();
     state = 0;
     BlueBook.SetActive(false);
     YellowBook.SetActive(false);
     DeadBook.SetActive(false);
     RedHeap.SetActive(false);
     BlueHeap.SetActive(false);
     Magic.SetActive(false);
     GroupBubble.SetActive(false);
     Phone.SetActive(false);
     DarkBackground2.SetActive(false);
     Bubble.transform.parent        = GroupBubble.transform;
     CthuluCalling.transform.parent = GroupBubble.transform;
     m_Audio = GetComponent <AudioSource>();
 }
Example #4
0
 public override void ObjectClicked(int id, GameObject obj)
 {
     if (id == 1)
     {
         obj.SetActive(false);
         state = 2;
     }
     else if (id == 2)
     {
         if (state < 5)
         {
             obj.GetComponent <CharacterController2D>().isClicked = false;
             if (state == 2 || state == 0)
             {
                 Bubble.SetActive(false);
                 state = 3;
                 BlueBook.SetActive(true);
                 Dropto(BlueBook, -3.2f);
             }
             else if (state == 3)
             {
                 state = 4;
                 YellowBook.SetActive(true);
                 Dropto(YellowBook, -3.2f);
             }
             else if (state == 4)
             {
                 state = 5;
                 DeadBook.SetActive(true);
                 Dropto(DeadBook, -3.2f);
                 obj.GetComponent <CharacterController2D>().isClicked = true;
             }
             m_Audio.clip = AudioDrop;
             m_Audio.Play();
         }
     }
     else if (id == 3)
     {
         if (state == 5)
         {
             m_Audio.clip = AudioOpen;
             m_Audio.Play();
             StartCoroutine("WaitForOpenBook");
         }
     }
 }
Example #5
0
    public override void ObjectClicked(int id, GameObject Obj)
    {
        if (id == 1)
        {
            if (state < 5)
            {
                Obj.GetComponent <CharacterController2D>().isClicked = false;
                if (state == 0)
                {
                    state = 1;
                    BlueBook.SetActive(true);
                    Dropto(BlueBook, -3.2f);
                }
                else if (state == 1)
                {
                    state = 2;
                    YellowBook.SetActive(true);
                    Dropto(YellowBook, -3.2f);
                }
                else if (state == 2)
                {
                    state = 3;
                    DeadBook.SetActive(true);
                    Dropto(DeadBook, -3.2f);
                    Obj.GetComponent <CharacterController2D>().isClicked = true;
                }
                m_Audio.clip = AudioDrop;
                m_Audio.Play();
            }
        }
        else if (id == 2)
        {
            if (state == 3)
            {
                foreach (GameObject obj in Letters)
                {
                    obj.SetActive(true);
                }
                foreach (GameObject obj in LettersFixed)
                {
                    obj.SetActive(true);
                }
                m_Audio.clip = AudioOpen;
                m_Audio.Play();
                state = 4;
            }
        }
        else if (id > 2 && id < 11)
        {
            if (state >= 4)
            {
                int idx = id - 3;
                if (eq0(state, id))
                {
                    state = set1(state, id);
                    Letters[idx].SetActive(false);
                    LettersDark[idx].SetActive(true);
                }

                /*
                 * else
                 * {
                 *  state = set0(state, id);
                 *  Letters[idx].SetActive(true);
                 *  LettersDark[idx].SetActive(false);
                 * }
                 */
                //Debug.Log(state);
                if (state == flag)
                {
                    TED.SetActive(true);
                    //Carpet.SetActive(true);
                    //Light.SetActive(true);
                    //Background.SetActive(false);
                    //DarkBackground2.SetActive(true);
                    foreach (GameObject obj in Letters)
                    {
                        obj.SetActive(false);
                    }
                    foreach (GameObject obj in LettersDark)
                    {
                        obj.SetActive(false);
                    }
                    StartCoroutine("WaitForComeDown");
                    m_Audio.clip = AudioTED;
                    m_Audio.Play();
                }
                else if (state == failflag)
                {
                    StartCoroutine("WaitForFail");
                }
            }
        }
    }
Example #6
0
 public override void ObjectClicked(int id, GameObject obj)
 {
     if (id == 2)
     {
         if (state < 5)
         {
             obj.GetComponent <CharacterController2D>().isClicked = false;
             if (state == 0)
             {
                 state = 1;
                 BlueBook.SetActive(true);
                 Dropto(BlueBook, -3.2f);
             }
             else if (state == 1)
             {
                 state = 2;
                 YellowBook.SetActive(true);
                 Dropto(YellowBook, -3.2f);
             }
             else if (state == 2)
             {
                 state = 3;
                 DeadBook.SetActive(true);
                 Dropto(DeadBook, -3.2f);
             }
             else if (state == 3)
             {
                 state = 4;
                 BlueHeap.SetActive(true);
                 Dropto(BlueHeap, -3.0f);
             }
             else if (state == 4)
             {
                 state = 5;
                 RedHeap.SetActive(true);
                 Dropto(RedHeap, -1.5f);
                 ObjectReplace(Shelf, EmptyShelf);
                 Phone.SetActive(true);
                 obj.GetComponent <CharacterController2D>().isClicked = true;
             }
             m_Audio.clip = state < 4 ? AudioDrop : AudioHeap;
             m_Audio.Play();
         }
     }
     else if (id == 3)
     {
         if (state < 6)
         {
             state = 9;
             Magic.SetActive(true);
             DeadBook.SetActive(false);
             DarkBackground2.SetActive(true);
             ObjectReplace(Father, PaganFather);
             SetMovement(Heretic, PaganFather, new Vector2(-20.0f, 0.0f), new Vector2(10.0f, 0.0f), 3.0f);
             m_Audio.clip = AudioHeretic;
             m_Audio.Play();
             StartCoroutine("WaitForRunning");
         }
     }
     else if (id == 4)
     {
         if (state == 5)
         {
             state = 10;
             ObjectReplace(Phone, Phone2);
             ObjectReplace(Father, FatherCalling);
             m_Audio.clip = AudioPhone;
             m_Audio.Play();
             StartCoroutine("WaitForReceiving");
         }
     }
 }