Ejemplo n.º 1
0
    public coordinate[] requireToChange(int side, int angle, coordinate co)
    {
        coordinate[] coo = new coordinate[5];
        coo[0] = co;
        if (side == 1 && (angle == 1 || angle == 3))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 1, 0);
            coo[2] = StaticMethodLib.onlyDoOffset(co, 0, -1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 1, 1);
            coo[4] = StaticMethodLib.onlyDoOffset(co, 1, 2);
        }
        else if (side == 1 && (angle == 2 || angle == 4))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, 1);
            coo[2] = StaticMethodLib.onlyDoOffset(co, -1, 1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 1, 0);
            coo[4] = StaticMethodLib.onlyDoOffset(co, -2, 1);
        }
        else if (side == 2 && (angle == 1 || angle == 3))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 1, 0);
            coo[2] = StaticMethodLib.onlyDoOffset(co, 1, -1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 0, 1);
            coo[4] = StaticMethodLib.onlyDoOffset(co, 1, -2);
        }
        else if (side == 2 && (angle == 2 || angle == 4))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, -1);
            coo[2] = StaticMethodLib.onlyDoOffset(co, -1, -1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 1, 0);
            coo[4] = StaticMethodLib.onlyDoOffset(co, -2, -1);
        }

        return(coo);
    }
Ejemplo n.º 2
0
    public coordinate[] requireToChange(int side, int angle, coordinate co)
    {
        coordinate[] coo = new coordinate[5];
        coo[0] = co;
        if (angle == 1)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, -1, 0);
            coo[2] = StaticMethodLib.onlyDoOffset(co, 0, -1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 0, 1);
        }
        else if ((side == 1 && angle == 2) || (side == 2 && angle == 4))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, -1);
            coo[2] = StaticMethodLib.onlyDoOffset(co, -1, 0);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 1, 0);
        }
        else if (angle == 3)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 1, 0);
            coo[2] = StaticMethodLib.onlyDoOffset(co, 0, -1);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 0, 1);
        }
        else if ((side == 1 && angle == 4) || (side == 2 && angle == 2))
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, 1);
            coo[2] = StaticMethodLib.onlyDoOffset(co, -1, 0);
            coo[3] = StaticMethodLib.onlyDoOffset(co, 1, 0);
        }

        coo[4] = new coordinate();

        return(coo);
    }
Ejemplo n.º 3
0
    public coordinate[] requireToChange(int side, int angle, coordinate co)
    {
        coordinate[] coo = new coordinate[5];
        coo[0] = co;
        if (angle == 1)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 1, 0);
        }
        else if (angle == 2)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, 1);
        }
        else if (angle == 3)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, -1, 0);
        }
        else if (angle == 4)
        {
            coo[1] = StaticMethodLib.onlyDoOffset(co, 0, -1);
        }

        for (int i = 2; i < 5; i++)
        {
            coo[i] = new coordinate();
        }
        return(coo);
    }
Ejemplo n.º 4
0
    public coordinate[] requireToChange(int side, int angle, coordinate co)
    {
        coordinate[] coo = new coordinate[5];
        coo[0] = co;

        coo[1] = StaticMethodLib.onlyDoOffset(co, 1, 0);
        coo[2] = StaticMethodLib.onlyDoOffset(co, -1, 0);
        coo[3] = StaticMethodLib.onlyDoOffset(co, 0, 1);
        coo[4] = StaticMethodLib.onlyDoOffset(co, 0, -1);

        return(coo);
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (Input.GetMouseButtonDown(0))
        {
            this.determine();
        }

        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.name.Length > 5)
            {
                if (hit.transform.name.Substring(0, 5).Equals("blok("))
                {
                    // Debug.Log(hit.transform.name.Substring(0, 5));
                    if (StaticMethodLib.stringTOcoordinate(hit.transform.name).getX() == co.getX() &&
                        StaticMethodLib.stringTOcoordinate(hit.transform.name).getY() == co.getY())
                    {
                    }
                    else
                    {
                        for (int i = 0; i < 20; i++)
                        {
                            for (int j = 0; j < 20; j++)
                            {
                                if (!b[i, j].getFix())
                                {
                                    b[i, j].setShow(false);
                                }
                            }
                        }
                        co = StaticMethodLib.stringTOcoordinate(hit.transform.name);
                    }
                }
            }
        }

        if (Input.GetMouseButtonDown(1))
        {
            Ray        ray2 = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit2;

            if (Physics.Raycast(ray2, out hit2))
            {
                // Debug.Log(hit.transform.name);
                dis = Main.ResetDisplayWay(hit2.transform.name);
                // blokAbstract.setblokName(hit.transform.name);
            }
        }

        coordinate[] coo = new coordinate[5];
        coo = findBlok(dis.getBlok(), dis.getSide(), dis.getAngle(), co);

        for (int i = 0; i < coo.Length; i++)
        {
            // Debug.Log(i + " is success");

            int x = coo[i].getX() - 1;
            int y = coo[i].getY() - 1;

            // Debug.Log("$ "+x+" "+y);

            if (x >= 20 || x < 0)
            {
            }
            else if (y >= 20 || y < 0)
            {
            }
            else
            {
                b[x, y].setShow(true);
            }
        }
    }
Ejemplo n.º 6
0
 void Start()
 {
     objName = gameObject.name;
     obj     = GameObject.Find(objName);
     co      = StaticMethodLib.stringTOcoordinate(objName);
 }