示例#1
0
    public void UpdatePieceDrag(Piece p, int equis, int ye, int startequis, int startye)
    {
        Drag = true;
        if (!Camera.main)
        {
            Debug.Log("Unable to find main camera");
            return;
        }

        RaycastHit hit;
        bool       bandDrag;

        //Si el mapa se debe agrandar, el 25.5 debe ser mayor, para que el Raycast aumente su alcance
        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 200.0f, LayerMask.GetMask("Board")))
        {
            anim = GetComponent <Animator>();
            if (p.gameObject.transform.childCount == 0)
            {
                if (p.getName() == "Slave2")
                {
                    p.GetComponent <Collider>().enabled = false;
                }

                Piece Ps;
                Ps = p;
            }


            p.transform.position = hit.point + Vector3.up / 2;
        }

        contador = contador + 1;
        for (int i = 0; i < ancho; i++)
        {
            for (int j = 0; j < alto; j++)
            {
                selectedCell = casillas[i, j];
                selectedCell.GetComponent <Renderer>().enabled = false;
            }
        }

        vectorAux    = Vector2.zero;
        vectorAux2   = Vector2.zero;
        selectedCell = casillas[equis, ye];
        selectedCell.ChangeColor(true, casillas, startequis, startye);
        selectedCell.GetComponent <Renderer>().enabled = true;

        vectorAux  = Vector2.zero;
        vectorAux2 = Vector2.zero;
    }
示例#2
0
 //modifica el color a la casilla en las coordenadas dadas segun este ocupada o no
 public void BreakFree(int x1, int y1)
 {
     selectedCell = casillas[x1, y1];
     selectedCell.ChangeColor(true, casillas, x1, y1);
     selectedCell.GetComponent <Renderer>().enabled = false;
 }
示例#3
0
 public void StatusCell(int x, int y)
 {
     selectedCell = casillas[x, y];
     selectedCell.ChangeColor(pieces[x, y] == null, casillas, x, y);
     selectedCell.GetComponent <Renderer>().enabled = false;
 }
示例#4
0
 public void Occupied(int x, int y)
 {
     selectedCell = casillas[x, y];
     selectedCell.ChangeColor(pieces[x, y] == null, casillas, x, y);
     //False ocupado, true desocupado
 }