void DrawBoard() { listLinesBoard = new List <LineRenderer>(); GameObject go = GameObject.Instantiate(lineHolder, this.transform); go.transform.position = go.transform.position + new Vector3(0f, 0f, linedistanceFromBoard); LineRenderer line = go.GetComponent <LineRenderer>(); //go.transform.parent = this.transform; line.loop = true; line.startWidth = lineBordureWidth; line.SetVertexCount(4); line.SetPosition(0, Grid.GetPosInWorld(_grille, new Point(0, 0))); line.SetPosition(1, Grid.GetPosInWorld(_grille, new Point(0, _nb_tiles_hauteur - 1))); line.SetPosition(2, Grid.GetPosInWorld(_grille, new Point(_nb_tiles_largeur - 1, _nb_tiles_hauteur - 1))); line.SetPosition(3, Grid.GetPosInWorld(_grille, new Point(_nb_tiles_largeur - 1, 0))); listLinesBoard.Add(line); for (int y = 1; y < _nb_tiles_hauteur; y++) { LineRenderer l = new LineRenderer(); go = GameObject.Instantiate(lineHolder, this.transform); go.transform.position = go.transform.position + new Vector3(0f, 0f, linedistanceFromBoard); line = go.GetComponent <LineRenderer>(); listLinesBoard.Add(line); line.startWidth = lineInsideWidth; line.SetPosition(0, Grid.GetPosInWorld(_grille, new Point(0, y))); line.SetPosition(1, Grid.GetPosInWorld(_grille, new Point(_nb_tiles_largeur - 1, y))); } for (int x = 1; x < _nb_tiles_largeur; x++) { LineRenderer l = new LineRenderer(); go = GameObject.Instantiate(lineHolder, this.transform); go.transform.position = go.transform.position + new Vector3(0f, 0f, linedistanceFromBoard); line = go.GetComponent <LineRenderer>(); line.startWidth = lineInsideWidth; listLinesBoard.Add(line); line.SetPosition(0, Grid.GetPosInWorld(_grille, new Point(x, 0))); line.SetPosition(1, Grid.GetPosInWorld(_grille, new Point(x, _nb_tiles_hauteur - 1))); } }
public void Teleport(Transform tran, Point p, float z) { Vector3 center = Grid.GetPosInWorld(_grille, new Point(p.x, p.y), z); tran.position = center; }