error CS0019: Operator `*' cannot be applied to operands of type `UnityEngine.Vector3' and `UnityEngine.Vector3'
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class BoardManger : MonoBehaviour {
public piece[,] pieces= new piece[5,5];
public GameObject WhitePiecePrefab;
public GameObject BlackPiecePrefab;
public Vector3 boardoffset = new Vector3(-4.0f,0,-4.0f);
private void start()
{
GenertBorad ();
}
private void GenertBorad(){
//Generate white team
for(int y=0;y<3;y++){
for (int x = 0; x < 5; x++)
{
//Genertate our piece
GeneratePiece(x,y);
}
}
}
private void GeneratePiece(int x , int y ){
GameObject go = Instantiate (WhitePiecePrefab) as GameObject;
go.transform.SetParent (transform);
piece p = go.GetComponent<piece> ();
pieces [x, y] = p;
MovePiece (p, x, y);
}
private void MovePiece(piece P , int x , int y )
{
P.transform.position = (Vector3.right * x) * (Vector3.forward * y) + boardoffset ;
}
private const float TILE_SIZE = 1.0f;
private const float TILE_OFFSET = 0.5f;
private int selectionX = -1;
private int selectionY = -1;
private void Update()
{
DrawChessboard();
}
private void DrawChessboard()
{
Vector3 widthLine = Vector3.right * 5;
Vector3 heigthLine = Vector3.forward * 5;
for (int i = 0; i <= 5; i++)
{
Vector3 start = Vector3.forward * i;
Debug.DrawLine(start, start + widthLine);
for (int j = 0; j <= 5; j++)
{
start = Vector3.right * j;
Debug.DrawLine(start, start + heigthLine);
}
// draw the selection
if (selectionX >= 0 && selectionY >= 0)
{
Debug.DrawLine(
Vector3.forward * selectionY + Vector3.right * selectionX,
Vector3.forward * (selectionY + 1) + Vector3.right * (selectionX + 1));
Debug.DrawLine(
Vector3.forward * (selectionY + 1) + Vector3.right * selectionX,
Vector3.forward * selectionY + Vector3.right * (selectionX + 1));
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Can anyone make a tutorial on how to make othello game using c#? 0 Answers
archer games question assign script to what?? 0 Answers
WebGL AR Game 0 Answers