// Creating empty wall on the nearest point to this position public void CreateEmptyWall(Vector3 position) { GameObject instance = Instantiate(_emptyWallPrefab); WallComponent pointWc = GetNearestPoint(position); pointWc.SetValue(false); instance.transform.position = pointWc.Position; instance.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; FieldMatrix.SetValueTo(pointWc.FieldCoordinates.x, pointWc.FieldCoordinates.y, pointWc); }
// Creating wall on the nearest point to this position public void CreateWall(Vector3 position) { WallComponent pointWc = GetNearestPoint(position); if (pointWc.FieldCoordinates.y < indexOfFirstRow || pointWc.IsWall) { return; } GameObject instance = Instantiate(_wallPrefab); pointWc.SetValue(true); instance.transform.position = pointWc.Position; instance.transform.localScale = GlobalVariables.CELL_SIZE * 0.5f; FieldMatrix.SetValueTo(pointWc.FieldCoordinates.x, pointWc.FieldCoordinates.y, pointWc); }