// Use this for initialization void Start() { forbiddenShapes = new List <C2DHoledPolyArc> (); blackShape = new List <C2DHoledPolyArc>(); whiteShape = new List <C2DHoledPolyArc>(); toPlay = Constants.StoneColor.Black; }
void makeMove(C2DPoint pos, Constants.StoneColor color, List <C2DHoledPolyArc> blackShape, List <C2DHoledPolyArc> whiteShape) { C2DHoledPolyArc stoneShape = makeCircle(pos, 1); List <C2DHoledPolyArc> ownShape; if (color == Constants.StoneColor.Black) { ownShape = blackShape; } else { ownShape = whiteShape; } List <C2DHoledPolyArc> shapesToMerge = new List <C2DHoledPolyArc> (); foreach (C2DHoledPolyArc poly in ownShape) { if (poly.Overlaps(stoneShape)) { shapesToMerge.Add(poly); } } merge(stoneShape, shapesToMerge, ownShape); }
public static GameObject CreateStone(Constants.StoneColor color, Vector3 position) { GameObject stone = safeInitialize(Constants.StonePrefabName, position); stone.GetComponent <StoneView> ().StoneColor = color; return(stone); }
void afterMove(C2DPoint pos, Constants.StoneColor color) { forbiddenShapes.Add (makeCircle(pos,Constants.stoneSize)); if (color == Constants.StoneColor.Black) { toPlay = Constants.StoneColor.White; } else { toPlay = Constants.StoneColor.Black; } Debug.Log (blackShape.Count); Debug.Log (whiteShape.Count); }
void afterMove(C2DPoint pos, Constants.StoneColor color) { forbiddenShapes.Add(makeCircle(pos, Constants.stoneSize)); if (color == Constants.StoneColor.Black) { toPlay = Constants.StoneColor.White; } else { toPlay = Constants.StoneColor.Black; } Debug.Log(blackShape.Count); Debug.Log(whiteShape.Count); }
public static GameObject CreateGroup(Constants.StoneColor color, Vector2[] positions) { var go = new GameObject(); MeshFilter mf = (MeshFilter)go.AddComponent("MeshFilter"); MeshRenderer mr = (MeshRenderer)go.AddComponent("MeshRenderer"); Mesh mesh = createMesh(); mr.material = _material; mr.material.color = Color.grey; mf.mesh = mesh; go.AddComponent("StoneView"); stone.GetComponent <StoneView> ().StoneColor = color; }
public bool addStone(C2DPoint pos) { Constants.StoneColor color = toPlay; //TODO: copy here List <C2DHoledPolyArc> _blackShape = blackShape; List <C2DHoledPolyArc> _whiteShape = whiteShape; if (HasPlace(pos) && isLegal(pos, color, _blackShape, _whiteShape)) { makeMove(pos, color, blackShape, whiteShape); afterMove(pos, color); return(true); } return(false); }
bool isLegal(C2DPoint pos, Constants.StoneColor color, List <C2DHoledPolyArc> _blackShape, List <C2DHoledPolyArc> _whiteShape) { return(true); }
// Use this for initialization void Start() { forbiddenShapes = new List<C2DHoledPolyArc> (); blackShape = new List<C2DHoledPolyArc>(); whiteShape = new List<C2DHoledPolyArc>(); toPlay = Constants.StoneColor.Black; }