コード例 #1
0
    void OnPrefabSelect(EditorDisplayObject info)
    {
        selectedInfo    = info;
        currentRotation = Vector3.zero;

        //Debug.Log(info.pid);
        //Debug.Log(prefabManager.GetGameObject(info.pid));
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        BackButton();

        if (Input.GetButtonDown("Fire2"))
        {
            selectedInfo = null;
            Destroy(indicatorCube);
        }

        var isPointerOverGameObject = EventSystem.current.IsPointerOverGameObject();

        if (!isPointerOverGameObject)
        {
            HighlightSquare();

            if (Input.GetButtonDown("Fire1") || Input.GetButtonDown("Fire2"))
            {
                if (indicatorCube == null)
                {
                    EditorScriptActions();
                }
            }

            if (Input.GetButton("Fire1"))
            {
                if (clicked == false)
                {
                    clicked = true;
                    PlaceNewObject();
                }
            }
            else
            {
                clicked = false;
            }
        }
        else
        {
            if (indicatorCube != null)
            {
                Destroy(indicatorCube);
            }
        }
    }
コード例 #3
0
    public void EditorScriptActions()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 100, editorObjectMask))
        {
            var editorScript = hit.transform.gameObject.GetComponent <EditorDisplayObject>();

            if (editorScript != null)
            {
                stageSelectedScript = editorScript;
                //EraseButton.SetActive(true);

                if (Input.GetButtonDown("Fire2"))
                {
                    RemoveObject();
                }
            }
        }
    }