Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        // Save a reference to the ARTapToPlaceObject component as our singleton instance
        Instance = this;

        arManager = FindObjectOfType <ARRaycastManager>();
        Debug.Log("arManager: " + arManager.ToString());

        arCamera = FindObjectOfType <ARSessionOrigin>().camera;
        Debug.Log("arCamera: " + arCamera.ToString());

        arSession = FindObjectOfType <ARSession>();
        Debug.Log("arSession: " + arSession.ToString());

        // Assign prefab in insepctor and place object with button click event
        if (placeObjectButton != null && objectToPlace != null)
        {
            placeObjectButton.onClick.AddListener(() =>
            {
                spawnedObject = Instantiate(objectToPlace, placementPose.position, placementPose.rotation);
            });
        }

        // Assign prefab in insepctor and place object with button click event
        if (destoryAllObjectButton != null)
        {
            destoryAllObjectButton.onClick.AddListener(() =>
            {
                SceneManager.LoadScene("ARScene");
                arSession.Reset();
            });
        }
    }
 private void Start()
 {
     _newScale      = new Vector3();
     _newRotation   = new Quaternion();
     _sessionOrigin = GetComponent <ARSessionOrigin>();
     myARTTPO       = GetComponent <ARTapToPlaceObject>();
 }
Пример #3
0
 private void Start()
 {
     arTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();
     gm = FindObjectOfType <GameManager>();
     graphics.SetActive(false);
     reset = false;
 }
Пример #4
0
    // Start is called before the first frame update
    private void Awake()
    {
        put    = FindObjectOfType <ARTapToPlaceObject>();
        width  = Screen.width;
        height = Screen.height;

        DrawGrid();
    }
Пример #5
0
 void Start()
 {
     arTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();
     gameManager        = FindObjectOfType <GameManager>();
     player             = GameObject.FindWithTag("Player");
     player.SetActive(false);
     action.text = "";
 }
Пример #6
0
    private void Awake()
    {
        List <Toggle> togglers = Resources.FindObjectsOfTypeAll <Toggle>().ToList();

        activeRoomToggle   = togglers.Find(t => Equals(t.tag, "Room"));
        arTapToPlaceObject = GameObject.Find("AR Session Origin").GetComponent <ARTapToPlaceObject>();

        activeRoomToggle.onValueChanged.AddListener(delegate { ToggleRoomActive(); });
    }
Пример #7
0
 // Start is called before the first frame update
 void Start()
 {
     arTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();
     gm     = FindObjectOfType <GameManager>();
     player = GameObject.FindWithTag("Player");
     health = 2;
     count  = 0;
     limit  = 2;
 }
Пример #8
0
    /// <summary>
    /// Change color of the cubes
    /// then close menu.
    /// </summary>
    public void ChangeCubeColor()
    {
        ARTapToPlaceObject tapToPlaceObject = FindObjectOfType <ARSessionOrigin>()
                                              .GetComponent <ARTapToPlaceObject>();

        if (!tapToPlaceObject)
        {
            Debug.LogError("Can't find ARTapToPlaceObject component on ARSessionOrigin. " +
                           "Either one of them is missing from the scene.");
            return;
        }
        Cube cube = tapToPlaceObject.gameObjectToInstantiate.GetComponent <Cube>();

        if (!cube)
        {
            Debug.LogError("Can't find Cube component on ARTapToPlaceObject.");
            return;
        }
        cube.SetProfile(profile);
        MenuHandler.instance.CloseMenu();
    }
Пример #9
0
 private void Awake()
 {
     artapInstace = this;
 }
Пример #10
0
 private void Start() {
     translator = gameObject.GetComponent<UITranslator>();
     arTap = gameObject.GetComponent<ARTapToPlaceObject>();
     panelHandler = DatabaseHandler.MainCanvas.GetComponent<PanelHandler>();
 }
Пример #11
0
 private void Start()
 {
     ARTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();
 }
Пример #12
0
 // Start is called before the first frame update
 void Start()
 {
     arTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();
     indicator          = arTapToPlaceObject.placementIndicator;
 }
Пример #13
0
    IEnumerator Start()
    {
        phaseInitiated     = PlayerPrefs.GetInt("Phase Initiated");
        ARTapToPlaceObject = FindObjectOfType <ARTapToPlaceObject>();

        Debug.Log("phase initiated: " + phaseInitiated);


        //Download JSON from URL according to phraseInitiated number
        WWW www = new WWW(chatbotURL[phaseInitiated - 1]);

        yield return(www);

        if (www.error == null)
        {
            Debug.Log("chatbot initiated: " + chatbotURL[phaseInitiated - 1]);
            Debug.Log("Get JSON: " + www.text);
        }
        else
        {
            Debug.Log("ERROR: " + www.error);
        }

        try
        {
            //Create new instance of bot.
            MainBot = new OscovaBot();

            OscovaBot.Logger.LogReceived += (s, o) =>
            {
                Debug.Log($"OscovaBot: {o.Log}");
            };

            //Import bot's knowledge-base from an Oryzer Workspace project file.
            //To read the content of this file ensure you've got Oryzer installed. Visit Oryzer.com

            //First read the knowledge.json file and create a workspace.

            /*Note: Oryzer usually saves file in .West file extensions so the file was intentionally
             * renamed to knowledge.json so Unity stores it as a resource. */

            //Get downloaded JSON text
            var tileFile  = www.text;
            var workspace = new WorkspaceGraph();
            workspace.LoadFromString(tileFile);

            //Import the workspace.
            MainBot.ImportWorkspace(workspace);
            MainBot.Dialogs.Add(new BotDialog());
            MainBot.Trainer.StartTraining();

            Debug.Log("Load rescource JSON: " + tileFile);

            //When the bot generates a response simply display it.
            MainBot.MainUser.ResponseReceived += (sender, evt) =>
            {
                if (evt.Response.Messages.Count == 0)
                {
                    Debug.Log(evt.Response.Text);
                    AddMessage($"Bot: {evt.Response.Text}", MessageType.Bot);
                }
                else
                {
                    foreach (var message in evt.Response.Messages)
                    {
                        if (message is TextMessage textMessage)
                        {
                            var textValue = textMessage.GetRandomText();
                            AddMessage($"Bot: {textValue}", MessageType.Bot);
                        }
                    }
                }
            };
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
        }
    }
Пример #14
0
 // Start is called before the first frame update
 void Start()
 {
     ArTapToPlaceObject = interaction.GetComponent <ARTapToPlaceObject>();
 }
Пример #15
0
 // Start is called before the first frame update
 void Start()
 {
     interaction = GameObject.Find("Interaction").GetComponent <ARTapToPlaceObject> ();
     moveStatus  = false;
 }