예제 #1
0
    //void AddMsg(string inputText, int c, bool isWifesText){
    //    GameObject temp;
    //    if (isWifesText){
    //         temp = Instantiate(wife_msg_prefab, msgContainer.transform);
    //    }
    //    else{
    //        temp = Instantiate(you_msg_prefab, msgContainer.transform);
    //    }
    //    //temp.transform.parent = msgContainer.transform;
    //    temp.transform.position = spawnPos.position;
    //    temp.GetComponentInChildren<Text>().text = inputText + " " + c.ToString(); ;
    //    messages.Add(temp);
    //}
    //WIFE
    public void AddMsg(ShopObjectRequest reqs)
    {
        GameObject temp = Instantiate(wife_msg_prefab, msgContainer.transform);

        //temp.transform.parent = msgContainer.transform;
        temp.transform.position = spawnPos.position;
        temp.GetComponentInChildren <Text>().text = reqs.RequestMessage;
        if (true)
        {
            messages.Add(temp);
        }

        GetComponent <AudioSource>().Play();
    }
예제 #2
0
    //[ContextMenu("Compare")]
    //public void TestCompare()
    //{
    //      print(123);

    //    ShopObjectRequest requester = new ShopObjectRequest();
    //    requester.toCompare = CurrentRequest;

    //    float percentage = requester.percentageComparison(toCompareToRequest.shopTags);
    //    bool exact = requester.exactComparison(toCompareToRequest.shopTags);
    //    string objectName = toCompareToRequest.shopTags.Name;

    //    print(objectName + (exact ? (" is exactly matched") : ("is not an exact but is " + percentage.ToString() + "% match.")));

    //}
    #endregion

    public void Compare()
    {
        CurrentRequest = list.current;

        float percentage = CurrentRequest.percentageComparison(toCompareToRequest.shopObject);

        list.mController.AddMsg(false, "I got a " + toCompGO.name);


        if (percentage > percentageRequired)
        {
            print(toCompareToRequest.name + " was adequate.");

            list.index++;

            list.mController.AddMsg(true, CurrentRequest.ReplyMessage);
        }
        else
        {
            list.mController.AddMsg(true, incorrectMessages[Mathf.RoundToInt(Random.Range(0, incorrectMessages.Length - 1))]); // add variations to this
            incorrect++;
            if (incorrect == 2)
            {
                incorrect = 0;
                list.mController.AddMsg(true, CurrentRequest.RequestMessage);
            }
        }

        if (percentage > percentageRequired)
        {
            print("Object Reqs Met");
        }
        else
        {
            print("Object Reqs Not Met");
        }
    }
예제 #3
0
    private void Update()
    {
        if (modeSelect == ModeSelect.teach)
        {
            if (phoneTeach == false)
            {
                phone.GetComponent <ShowPhone>().onScreen = true;
            }

            if (Velocity.GetComponent <Rigidbody>().velocity.magnitude == 0)
            {
                if (addedMoveMsg == false)
                {
                    msgs.GetComponent <messageController>().AddMsg(true, "look at the trolley, hold Left and Right mouse buttons to move");
                    addedMoveMsg = true;
                }
            }
            if (Velocity.GetComponent <Rigidbody>().velocity.magnitude > 1)
            {
                if (moved == false)
                {
                    msgs.GetComponent <messageController>().AddMsg(false, "Yes i am a Pro!");
                    msgs.GetComponent <messageController>().AddMsg(true, "Great!");
                    msgs.GetComponent <messageController>().AddMsg(true, "Now go to any item and left click it to put it in the trolley");
                    moved = true;
                }
            }

            if (TeachItemPick == true)
            {
                if (teachPhone == false)
                {
                    phoneTeach = true;
                    msgs.GetComponent <messageController>().AddMsg(false, "I've so got this!");
                    msgs.GetComponent <messageController>().AddMsg(true, "Perfect!");
                    msgs.GetComponent <messageController>().AddMsg(true, "now use the scroll wheel to hide and show the phone");
                    teachPhone = true;
                }
            }

            if (phone.GetComponent <ShowPhone>().onScreen == false)
            {
                teachComplete = true;
            }

            if (phone.GetComponent <ShowPhone>().onScreen == true && teachComplete == true)
            {
                if (done == false)
                {
                    msgs.GetComponent <messageController>().AddMsg(false, "Got it");
                    msgs.GetComponent <messageController>().AddMsg(true, "Okay thats it, now lets do some shopping!");
                    msgs.GetComponent <messageController>().AddMsg(true, "Also... try not to make a mess of it");
                    done = true;
                }



                timer += 1 * Time.deltaTime;

                print(timer);

                if (timer > 3)
                {
                    modeSelect = RequestList.ModeSelect.test;
                    GetComponent <GameLoop>().gameState = RequestList.ModeSelect.test;
                }
            }
        }
        if (modeSelect == ModeSelect.test)
        {
            inLevel = testRequestList;


            if (index < 4)
            {
                if (current != inLevel[index])
                {
                    GetComponent <GameLoop>().BumpScore();
                    current = inLevel[index];
                    mController.AddMsg(true, current.RequestMessage);
                }
            }
            else
            {
                current = null;
                if (testComplete == false)
                {
                    msgs.GetComponent <messageController>().AddMsg(true, "head to the exit when you're ready!");
                    testComplete = true;
                }
                print("Win");
                win = true;
            }
        }
        if (modeSelect == ModeSelect.challenge)
        {
            while (inLevel.Count < 8)
            {
                int toUse = Random.Range(0, itemRequestList.Count);

                inLevel.Add(itemRequestList[toUse]);
                itemRequestList.RemoveAt(toUse);
            }

            if (index < 8)
            {
                if (current != inLevel[index])
                {
                    GetComponent <GameLoop>().BumpScore();
                    current = inLevel[index];
                    mController.AddMsg(true, current.RequestMessage);
                }
            }
            else
            {
                current = null;
                print("Win");
                if (win == false)
                {
                    msgs.GetComponent <messageController>().AddMsg(true, "Quick, get out before they lock up!");

                    win = true;
                }
            }



            // mController.AddMsg(itemRequestList[Random.Range(0, itemRequestList.Count)]);
        }
    }