コード例 #1
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     //check if they leave and haev purchased clothes
     if (collision.gameObject.tag == "Exit" && pC.purchased == true)
     {
         foreach (GameObject g in GameManager.clothes)
         {
             DontDestroyOnLoad(g);
         }
         StartCoroutine(FadeLeave());
     }
     else if (collision.gameObject.tag == "Exit" && gS.anx > 1.5)
     {
         SceneManager.LoadScene(0);
     }
     else if (collision.gameObject.tag == "Exit" && pC.purchased == false && GameManager.clothes.Count > 0)
     {
         Node dontLeave = new Node();
         dontLeave.thoughts    = "I'm not letting myself leave until I purchase some clothes!";
         dontLeave.thoughtTime = 2;
         dontLeave.voiceLine   = noLeave;
         tT.add(dontLeave);
     }
     else if (collision.gameObject.tag == "Exit" && pC.purchased == false)
     {
         start = true;
     }
 }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (GameManager.clothes.Count <= clothCount)
     {
         rT.end  = true;
         rT2.end = true;
         rT3.end = true;
     }
     if (rT.fin || rT2.fin || rT3.fin)
     {
         // Debug.Log("step 1");
         tT.enabled = true;
         topUI.SetActive(false);
         foreach (GameObject c in clothSet)
         {
             c.SetActive(false);
             c.GetComponent <SpriteRenderer>().enabled = false;
         }
         counterScreen.SetActive(false);
         // Debug.Log("step 2");
         move.enabled = true;
         pC.enabled   = true;
         // Debug.Log("step 3");
         Node newNode = new Node();
         newNode.thoughts    = "Finally, I can get out of here!";
         newNode.thoughtTime = 2;
         tT.add(newNode);
         pC.purchased = true;
     }
 }
コード例 #3
0
    IEnumerator Convo(GameObject player)
    {
        head.sprite = headSprite;
        Vector3 oldPos = topUI.GetComponent <RectTransform>().position;

        for (int i = 0; i < 8; i++)
        {
            yield return(new WaitForEndOfFrame());

            topUI.GetComponent <RectTransform>().position = new Vector3(topUI.GetComponent <RectTransform>().position.x, Mathf.Lerp(topUI.GetComponent <RectTransform>().position.y, loc.position.y, .1f), topUI.GetComponent <RectTransform>().position.z);
        }
        for (; tT.current.nextNode != null;)
        {
            yield return(new WaitForEndOfFrame());
        }
        if (tT.thought.text != "")
        {
            yield return(new WaitForSecondsRealtime(tT.current.thoughtTime));
        }
        tT.add(new Node(" ", 2f));
        tT.add(new Node("just looking", 1.4f, tessLines[0]));
        tT.add(new Node(" ", 3));
        tT.add(new Node("thank you...", 1, tessLines[1]));
        tT.add(new Node(" ", 2));
        yield return(new WaitForEndOfFrame());

        Vector3 dir   = player.transform.position - transform.position;
        float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 90;

        transform.parent.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        helpText.text             = "Excuse me Mister, are you looking for the men's section?";
        aud.PlayOneShot(workLines[0]);
        yield return(new WaitForSecondsRealtime(2));

        helpText.text = "";
        yield return(new WaitForSecondsRealtime(1.4f));

        helpText.text = "Oh the bathrooms and fitting rooms are in the back";
        aud.PlayOneShot(workLines[1]);
        yield return(new WaitForSecondsRealtime(2));

        helpText.text = "";
        yield return(new WaitForSecondsRealtime(1));

        helpText.text = "No problem sir, anything for our customers.";
        aud.PlayOneShot(workLines[2]);
        yield return(new WaitForSecondsRealtime(1.5f));

        for (int i = 0; i < 8; i++)
        {
            yield return(new WaitForEndOfFrame());

            topUI.GetComponent <RectTransform>().position = new Vector3(topUI.GetComponent <RectTransform>().position.x, Mathf.Lerp(topUI.GetComponent <RectTransform>().position.y, oldPos.y, .1f), topUI.GetComponent <RectTransform>().position.z);
        }
        player.GetComponent <Movement>().enabled      = true;
        player.GetComponent <PickupClothes>().enabled = true;
        topUI.SetActive(false);
        work.enabled = true;
        talking      = false;

        yield return(new WaitForSecondsRealtime(3));

        canTalk = true;
    }
コード例 #4
0
    // Update is called once per frame
    void Update()
    {
        //What's basically going on is there's an array of bools
        //when anxiety reaches a certain point a new thought will be displayed
        //and then never displayed again
        //the array of bools keeps track of this
        img.sprite = heads[index][index2];
        if (gS.anx > 0 && !thoughts[0])
        {
            Node newThought = new Node();
            newThought.thoughts    = "I can't let anyone see me";
            newThought.thoughtTime = 2;
            newThought.voiceLine   = lines[0];
            tT.add(newThought);
            thoughts[0] = true;
            index       = 0;
        }
        if (gS.anx > .9f && !thoughts[1])
        {
            Node newThought = new Node();
            newThought.thoughts    = "Fuckkk people are staring at me";
            newThought.thoughtTime = 2;
            newThought.voiceLine   = lines[1];
            tT.add(newThought);
            thoughts[1] = true;
            index       = 4;
        }
        if (gS.anx > .6f && !thoughts[2])
        {
            Node newThought = new Node();
            newThought.thoughts    = "I hate this, I hate this, I hate this";
            newThought.voiceLine   = lines[2];
            newThought.thoughtTime = 2;
            tT.add(newThought);
            thoughts[2] = true;
            index       = 2;
        }
        if (gS.anx > .7467f && !thoughts[5])
        {
            Node newThought = new Node();
            newThought.thoughts    = "I hate it, I hate it, I hate it";
            newThought.voiceLine   = lines[5];
            newThought.thoughtTime = 2;
            tT.add(newThought);
            thoughts[5] = true;
            index       = 5;
        }
        if (gS.anx > .22f && !thoughts[4])
        {
            Node newThought = new Node("You need to stay calm Kril, pretend like no one's around", 4, lines[4]);
            tT.add(newThought);
            thoughts[4] = true;
            index       = 1;
        }
        if (gS.anx > 1.2f && !thoughts[3])
        {
            Node badEnd = new Node("I can't take this anymore. I can barely think. I have to get out!", 3, lines[3]);
            tT.add(badEnd);
            thoughts[3] = true;
            pC.enabled  = false;
            index       = 3;
        }

        if (Mathf.Floor(Random.Range(0, 180)) == 1)
        {
            blink = true;
        }

        if (blink)
        {
            counter++;
            //Debug.Log(heads.GetLength(index));
            if (index2 < 5 && counter > 3)
            {
                index2++;
                counter = 0;
            }
            else if (counter > 3)
            {
                index2 = 0;
                blink  = false;
            }
        }
    }
コード例 #5
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "ClothesZone" && GameManager.anxiety <= 1.6f)
        {
            if (collision.GetComponent <ClothType>() != null)
            {
                collidedClothes = collision.GetComponent <ClothType>().clothType;
            }
            if (canBuy && Input.GetKeyDown(KeyCode.Mouse0) && !clothesScreen.activeInHierarchy && collision.GetComponent <ClothType>() && !mH.checkout)
            {
                if (GameManager.clothes.Count == 0 && !played[0])
                {
                    Node newThought = new Node("Ooo they're so many cute options!", 2, clothesThoughts[0]);
                    tT.add(newThought);
                    played[0] = true;
                }
                else if (GameManager.clothes.Count == 1 && !played[1])
                {
                    Node newThought = new Node("I wonder if these are the right size?", 2, clothesThoughts[2]);
                    tT.add(newThought);
                    played[1] = true;
                }

                /*else if(GameManager.clothes.Count == 2)
                 * {
                 *  Node newThought = new Node("I hope I'm not spending too much", 2, clothesThoughts[1]);
                 *  tT.add(newThought);
                 * }*/
                clothesScreen.SetActive(true);
                foreach (ClothesSpawner c in cS)
                {
                    c.Spawn();
                }
                //turn off player movement
                this.GetComponent <Movement>().up      = false;
                this.GetComponent <Movement>().left    = false;
                this.GetComponent <Movement>().down    = false;
                this.GetComponent <Movement>().right   = false;
                this.GetComponent <Movement>().enabled = false;
                clothesCount++;
                collidedClothes = collision.GetComponent <ClothType>().clothType;
                canBuy          = false;
                this.GetComponent <PickupClothes>().enabled = false;
            }
        }
        //purchasing clothes
        if ((collision.gameObject.tag == "Counter" || collision.gameObject.tag == "Counter2" || collision.gameObject.tag == "Counter3") && Input.GetKeyDown(KeyCode.Mouse0) && GameManager.anxiety <= 1.55f)
        {
            if (clothesCount > 0)
            {
                ArrayList clothSet = new ArrayList();
                foreach (GameObject c in GameManager.clothes)
                {
                    GameObject newCloth = Instantiate(c) as GameObject;
                    newCloth.transform.position = cart.transform.position + new Vector3(Random.Range(-1f, 1f), Random.Range(-.5f, .5f), .03f);
                    clothSet.Add(newCloth);
                }
                check.clothSet = clothSet;
                checkOut.SetActive(true);
                mH.checkout           = true;
                GameManager.cantLoose = true;
                if (collision.gameObject.tag == "Counter")
                {
                    checkOut.GetComponentInChildren <Checkout>().rT.enabled  = true;
                    checkOut.GetComponentInChildren <Checkout>().rT2.enabled = false;
                    checkOut.GetComponentInChildren <Checkout>().rT3.enabled = false;
                }
                else if (collision.gameObject.tag == "Counter2")
                {
                    checkOut.GetComponentInChildren <Checkout>().rT2.enabled = true;
                    checkOut.GetComponentInChildren <Checkout>().rT.enabled  = false;
                    checkOut.GetComponentInChildren <Checkout>().rT3.enabled = false;
                }
                else if (collision.gameObject.tag == "Counter3")
                {
                    checkOut.GetComponentInChildren <Checkout>().rT3.enabled = true;
                    checkOut.GetComponentInChildren <Checkout>().rT2.enabled = false;
                    checkOut.GetComponentInChildren <Checkout>().rT.enabled  = false;
                }
                topUI.SetActive(true);
                this.GetComponent <Movement>().up           = false;
                this.GetComponent <Movement>().left         = false;
                this.GetComponent <Movement>().down         = false;
                this.GetComponent <Movement>().right        = false;
                this.GetComponent <Movement>().enabled      = false;
                this.GetComponent <PickupClothes>().enabled = false;
            }
        }
    }
コード例 #6
0
ファイル: WorkerSight.cs プロジェクト: srl447/CapstoneProject
    IEnumerator Convo(GameObject player)
    {
        head.sprite = headSprite;
        Vector3 oldPos = topUI.GetComponent <RectTransform>().position;

        for (int i = 0; i < 8; i++)
        {
            yield return(new WaitForEndOfFrame());

            topUI.GetComponent <RectTransform>().position = new Vector3(topUI.GetComponent <RectTransform>().position.x, Mathf.Lerp(topUI.GetComponent <RectTransform>().position.y, loc.position.y, .1f), topUI.GetComponent <RectTransform>().position.z);
        }
        for (; tT.current.nextNode != null;)
        {
            yield return(new WaitForEndOfFrame());
        }
        if (tT.thought.text != "")
        {
            yield return(new WaitForSecondsRealtime(tT.current.thoughtTime));
        }
        tT.add(new Node(" ", 2f));
        tT.add(new Node("hi", 1f, tessLines[0]));
        tT.add(new Node(" ", 4));
        tT.add(new Node("   thanks.", 1, tessLines[1]));
        tT.add(new Node(" ", 2));
        yield return(new WaitForEndOfFrame());

        Vector3 dir   = player.transform.position - transform.position;
        float   angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + 90;

        transform.parent.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        helpText.text             = "Hello Sir!";
        aud.PlayOneShot(workLines[0]);
        yield return(new WaitForSecondsRealtime(2));

        helpText.text = "";
        yield return(new WaitForSecondsRealtime(1f));

        helpText.text = "The men's section on the right.";
        aud.PlayOneShot(workLines[1]);
        yield return(new WaitForSecondsRealtime(2));

        helpText.text = "Fitting Rooms and Bathrooms are in the back";
        aud.PlayOneShot(workLines[2]);
        yield return(new WaitForSecondsRealtime(2));

        helpText.text = "";
        yield return(new WaitForSecondsRealtime(1));

        helpText.text = "If you need anything else, just ask...";
        aud.PlayOneShot(workLines[3]);
        yield return(new WaitForSecondsRealtime(1));

        for (int i = 0; i < 8; i++)
        {
            yield return(new WaitForEndOfFrame());

            topUI.GetComponent <RectTransform>().position = new Vector3(topUI.GetComponent <RectTransform>().position.x, Mathf.Lerp(topUI.GetComponent <RectTransform>().position.y, oldPos.y, .1f), topUI.GetComponent <RectTransform>().position.z);
        }
        player.gameObject.GetComponent <Movement>().enabled = true;
        topUI.SetActive(false);
        work.enabled = true;
        player       = null;

        yield return(new WaitForSecondsRealtime(3));

        canTalk = true;
    }