コード例 #1
0
        public void OnUpdate()
        {
            if (selectedDot.Owner.GetType() == typeof(Player))
            {
                if (!(selectedDot.transform.position.y > selectedDot.Owner.cam.ScreenToWorldPoint(Input.mousePosition).y))
                {
                    AbsConnection.AbstractDraw(selectedDot.transform.position, selectedDot.Owner.cam.ScreenToWorldPoint(Input.mousePosition));
                }
                else
                {
                    AbsConnection.AbstractDraw(selectedDot.Owner.cam.ScreenToWorldPoint(Input.mousePosition), selectedDot.transform.position);
                }
            }


            //counter for dragging
            if (counter > 0.3)
            {
                counter = 0;
                OnDrag  = true;
            }
            else
            {
                counter += Time.deltaTime;
            }
        }
コード例 #2
0
    public static Connection CreateConnection(Vector2 Origin, Vector2 Destination) //static form for ConnectionCreation
    {
        GameObject temp = Instantiate(GameHandler.gm.ConnectionPrefab, GameHandler.gm.ConnectionFolder) as GameObject;

        temp.transform.position = new Vector3(temp.transform.position.x, temp.transform.position.y, 1);
        Connection ConnectTemp = temp.GetComponent <Connection>();

        ConnectTemp.cube = temp.GetComponentInChildren <SpriteRenderer>().transform;
        ConnectTemp.AbstractDraw(Origin, Destination);
        temp.name = "AbsConnect";
        return(ConnectTemp);
    }