Пример #1
0
        private static List <Dictionary <string, string> > ParseObjectsText(List <string> ObjectsText)
        {
            List <Dictionary <string, string> > Objects = new List <Dictionary <string, string> >();

            foreach (var ObjectText in ObjectsText)
            {
                List <string> ObjectFieldsString = new List <string>();
                var           counter            = 0;
                var           startFieldPosition = 0;
                var           endFieldPosition   = 0;
                while (counter < ObjectText.Length)
                {
                    if (ObjectText[counter] == ',' || ObjectText[counter] == '{')
                    {
                        startFieldPosition = counter;
                        endFieldPosition   = GetEndFieldPositonInObject(ObjectText, counter + 1);
                        if (endFieldPosition != 0)
                        {
                            ObjectFieldsString.Add(ObjectText.Substring(startFieldPosition, endFieldPosition - startFieldPosition).Trim(',', '\n', '\r', ' '));
                            counter = endFieldPosition;
                        }
                        if (endFieldPosition == 0)
                        {
                            counter++;
                        }
                    }
                    else
                    {
                        counter++;
                    }
                }
                Objects.Add(ParseFieldsString(ObjectFieldsString));
            }
            return(Objects);
        }
Пример #2
0
    IEnumerator keyPicked()
    {
        KeyMod.SetActive(false);
        LockMod.SetActive(false);
        KeyIcon.SetActive(true);
        LockIcon.SetActive(true);
        ObjectText.SetActive(false);
        talkText.GetComponent <Text>().text = "A key and a lockpick !\n Now i can open that door";
        yield return(new WaitForSeconds(5));

        talkText.GetComponent <Text>().text = "";
        ObjectText.transform.GetChild(0).GetComponent <Text>().text = "Open the house door with the key";
        ObjectText.SetActive(true);
    }
Пример #3
0
    /// <summary>
    /// Checks if there's currently a character in front of the player to talk to.
    /// </summary>
    private void CheckTalk()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, DirectionVector, out hit, 1))
        {
            characterFacing = hit.collider.GetComponent <NPCController>();
            objectFacing    = hit.collider.GetComponent <ObjectText>();
        }
        else
        {
            characterFacing = null;
            objectFacing    = null;
        }
    }
Пример #4
0
    IEnumerator key_2Picked()
    {
        ghostDisabler.SetActive(true);
        key2Mod.SetActive(false);
        KeyIcon.SetActive(true);
        ObjectText.SetActive(false);
        talkText.GetComponent <Text>().text = "Another key,\nlets open the door with this one";
        yield return(new WaitForSeconds(1));

        Flight.GetComponent <LightFlicker>().enabled = true;
        yield return(new WaitForSeconds(4));

        talkText.GetComponent <Text>().text = "";
        ObjectText.transform.GetChild(0).GetComponent <Text>().text = "Open the house door with the key";
        ObjectText.SetActive(true);
    }
Пример #5
0
    void ObjectAnchorAdded(ARObjectAnchor anchorData)
    {
        Debug.Log("ObjectAnchorAdded");
        GameObject go = GameObject.Instantiate <GameObject> (m_ObjectPrefab);

        if (go != null)
        {
            //do coordinate conversion from ARKit to Unity
            go.transform.position = UnityARMatrixOps.GetPosition(anchorData.transform);
            go.transform.rotation = UnityARMatrixOps.GetRotation(anchorData.transform);

            objectAnchorMap [anchorData.referenceObjectName] = go;
            go.name = anchorData.referenceObjectName;
            ObjectText objText = go.GetComponent <ObjectText> ();
            if (objText)
            {
                objText.UpdateTextMesh(anchorData.referenceObjectName);
            }
        }
    }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        if (!FightManager.InFight)
        {
            ParseMovement();
        }

        ParseInput();


        if (touching.Count > 0 && !FightManager.InFight)
        {
            foreach (GameObject other in touching)
            {
                if (other.tag == "CharNPC")
                {
                    NPCScript npc = other.gameObject.GetComponent <NPCScript>();
                    if (npc.HasDialog() && !DialogManager.Instance.IsOpen)
                    {
                        if (Input.GetButtonDown("Talk"))
                        {
                            DialogManager.Instance.StartDialog(npc);
                            ObjectText.RemoveTarget();
                        }
                        else
                        {
                            ObjectText.SetTarget(other.gameObject);
                        }
                    }
                }
            }
        }
        else
        {
            ObjectText.RemoveTarget();
        }
    }