예제 #1
0
 // Use this for initialization
 void Start()
 {
     forbiddenShapes = new List <C2DHoledPolyArc> ();
     blackShape      = new List <C2DHoledPolyArc>();
     whiteShape      = new List <C2DHoledPolyArc>();
     toPlay          = Constants.StoneColor.Black;
 }
예제 #2
0
    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);
    }
예제 #3
0
    public static GameObject CreateStone(Constants.StoneColor color, Vector3 position)
    {
        GameObject stone = safeInitialize(Constants.StonePrefabName, position);

        stone.GetComponent <StoneView> ().StoneColor = color;

        return(stone);
    }
예제 #4
0
 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);
 }
예제 #5
0
 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);
 }
예제 #6
0
    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;
    }
예제 #7
0
    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);
    }
예제 #8
0
 bool isLegal(C2DPoint pos, Constants.StoneColor color, List <C2DHoledPolyArc> _blackShape, List <C2DHoledPolyArc> _whiteShape)
 {
     return(true);
 }
예제 #9
0
 // Use this for initialization
 void Start()
 {
     forbiddenShapes = new List<C2DHoledPolyArc> ();
     blackShape = new List<C2DHoledPolyArc>();
     whiteShape = new List<C2DHoledPolyArc>();
     toPlay = Constants.StoneColor.Black;
 }