//old
    void CheckForInteractableOld()
    {
        RaycastHit hit;
        Camera     camera = GetComponentInChildren <Camera>();
        Ray        ray    = camera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

        if (Physics.Raycast(ray, out hit, 2))
        {
            if (hit.transform.tag == "Interactable")
            {
                interactionNotification.SetActive(true);
                if (Input.GetButtonDown("X_Button") && !activeInventory)
                {
                    HackingConsole console = hit.transform.gameObject.GetComponent <HackingConsole>();
                    AccessedNewInterface(console);
                    activeInventory = true;
                }
            }
            else
            {
                interactionNotification.SetActive(false);
            }
        }
        else
        {
            interactionNotification.SetActive(false);
        }
        //if(Physics.Raycast(cameraObject.transform.position, cameraObject.transform.forward, float maxDistance, int layerMask))
    }
Beispiel #2
0
 public void CreateFunction(List <string> functionNames, HackingConsole parent, GameObject hackingUI)
 {
     for (int i = 0; i < functionNames.Count; i++)
     {
         GameObject function = (GameObject)Instantiate(Resources.Load("Function"), new Vector3(230, 100 - (10 * i), 0), Quaternion.identity);
         function.GetComponent <RectTransform>().position = new Vector3(230, 100 - (10 * i), 0) * 0.01f;
         function.GetComponent <Function>().tag           = functionNames[i];
         function.GetComponent <Function>().parent        = parent;
         function.GetComponentInChildren <Text>().text    = functionNames[i];
         function.transform.parent = hackingUI.transform;
         print(function);
         functions.Add(function);
     }
 }
/*
 * calls all methods and sets all variables when a new interface is accessed.
 */
    public void AccessedNewInterface(HackingConsole console)
    {
        GameObject newUI;

        if (console.hackingUI != null)
        {
            newUI = console.hackingUI;
            newUI.SetActive(true);
        }
        else
        {
            newUI = (GameObject)Instantiate(console.hackingUIPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            console.UIRealReference(newUI);
            console.GetLines();
            console.SetCorrectSubLineValue();
            console.CreateFunctions();
            hasTutorial = console.hasTutorial;
        }

        //lineController.activeLine = 0;
        SetActiveInterface(newUI);
        activeInterface.transform.parent = HackingUIParent.transform;
        activeInterface.GetComponent <RectTransform>().localPosition = new Vector3(0, 0, 0);
        activeInterface.GetComponent <RectTransform>().eulerAngles   = HackingUIParent.transform.eulerAngles;
        activeLineManager = activeInterface.GetComponent <LineManager>();
        lineController.activeLineObject = activeLineManager.lines[lineController.activeLine];
        lineController.UpdateHighlightedLine();
        interactionNotification.SetActive(false);
        HackingUIParent.SetActive(true);
        subObjectInteraction = false;

        /*
         * if (createTutorial)
         * {
         *
         * tutorial.SetActive(true);
         * createTutorial = false;
         * }*/
        if (console.tutorial != null && !console.tutCalled)
        {
            console.tutorial.SetActive(true);
            tutorial          = console.tutorial;
            createTutorial    = false;
            console.tutCalled = true;
        }
    }