Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        if (i >= allthings.Length)
        {
            i = 0;
        }
        else if (i < 0)
        {
            i = allthings.Length - 1;
        }

        for (int x = 0; x < allthings.Length; x++)
        {
            drag temd = (drag)allthings[x];
            temd.theone = false;
        }
        d            = (drag)allthings[i];
        d.theone     = true;
        objname.text = d.gameObject.name;
        d.rotate     = r;


        if (Input.GetAxis("Mouse ScrollWheel") > 0f) // forward
        {
            camin();
        }
        else if (Input.GetAxis("Mouse ScrollWheel") < 0f) // backwards
        {
            camout();
        }
        if (Input.GetMouseButtonDown(1) && Input.GetMouseButtonDown(0))
        {
            actionlog.WriteLine("moving camera");
        }
        else if (Input.GetMouseButtonDown(0))
        {
            actionlog.WriteLine("drag to move");
        }
        else if (Input.GetMouseButtonDown(1))
        {
            actionlog.WriteLine("drag to rotate");
        }
        if (Input.GetMouseButton(1) && Input.GetMouseButton(0))
        {
            rotx = Input.GetAxis("Mouse X") * 10f * Mathf.Deg2Rad;
            roty = Input.GetAxis("Mouse Y") * 10f * Mathf.Deg2Rad;
            cam.transform.RotateAround(d.transform.position, cam.transform.up, -rotx);
            cam.transform.RotateAround(d.transform.position, cam.transform.right, roty);
        }
    }
Esempio n. 2
0
    public void OnDrop(PointerEventData eventData)

    {
        string text12;
        string text13;
        drag   f = eventData.pointerDrag.GetComponent <drag>();

        f.gh.transform.SetParent(this.gameObject.transform);
        text12 = GetComponentInChildren <Text>().text;
        text13 = f.GetComponent <Text>().text;
        if (text12 == text13)
        {
            Debug.Log(text12);
            //  gameObject.GetComponent<Image>().color = new Color32(255, 0, 255,100);
            t = 1;
        }
    }
Esempio n. 3
0
    public void OnDrop(PointerEventData eventData)
    {
        //Debug.Log(eventData.pointerDrag.name + " was dropped on " + gameObject.name);

        drag d = eventData.pointerDrag.GetComponent <drag>();

        drag.Slot L = drag.Slot.LEFT;
        drag.Slot R = drag.Slot.RIGHT;
        drag.Slot W = drag.Slot.WEAPON;

        drag.Number S = drag.Number.SWORD;

        if (d != null)
        {
            if (W == typeOfItem)
            {
                d.parentToReturnTo = this.transform;
            }
            else if (L == typeOfItem)
            {
                Debug.Log("LEFT");
                Character.Signal = 0;
                if (StartGame.PlayerPoint != 0)
                {
                    Destroy(d.gameObject);
                }
                else if (StartGame.PlayerPoint == 0 && d.MyType() == S)
                {
                    Destroy(d.gameObject);
                }
            }
            else if (R == typeOfItem)
            {
                Debug.Log("RIGHT");
                Character.Signal = 1;
                if (StartGame.PlayerPoint != 0)
                {
                    Destroy(d.gameObject);
                }
                else if (StartGame.PlayerPoint == 0 && d.MyType() == S)
                {
                    Destroy(d.gameObject);
                }
            }
        }
    }
Esempio n. 4
0
 void Awake()
 {
     instance = this;
 }