Beispiel #1
0
    void SetAPlaces()
    {
        //Place place = new Place(PlaceBlock);
        //place.SetAPlace(0 - x_resolution*1.1f, 0 - y_resolution*.8f, x_resolution*.12f, y_resolution*.25f);
        int            id = 0, len = 24, j = 0, i = 0;;
        List <Vector2> startPos = new List <Vector2>();

        startPos.Add(new Vector2(0 - x_resolution * 1.0f, 0 - y_resolution * .8f));
        startPos.Add(new Vector2(0 + x_resolution * .25f, 0 - y_resolution * .8f));
        startPos.Add(new Vector2(0 - x_resolution * 1.0f, 0 + y_resolution * .8f));
        startPos.Add(new Vector2(0 + x_resolution * .25f, 0 + y_resolution * .8f));

        Vector2 scale = new Vector2(x_resolution * .12f, y_resolution * .25f);
        Vector2 step  = new Vector2(x_resolution * 0.15f, 0);

        for (id = 0; id < len; id++)
        {
            string key   = "Places" + id.ToString();
            Place  place = new Place();
            place.AddOject(PlaceBlock, startPos[j] + step * i);
            place.ID = id;
            if (id >= 12)
            {
                place.Revert();
            }
            place.setLayer(2);
            place.setColor(DefaultPColor);
            place.setName(key);
            place.name = key;
            place.setBoxColleder(new Vector2(0.01f, 0), new Vector2(1.01f, 2.5f));
            place.setLayer("PlaceLayer");
            place.AddRigidBody();
            place.AddCollisator(gamePlay);
            BoardBuilder.Places.Add(key, place);

            if (id == 11)
            {
                BoardBuilder.homeB.AddOject(PlaceBlock, startPos[j] + step * (i + 1));
                BoardBuilder.homeB.setBoxColleder(new Vector2(0.01f, 0), new Vector2(1.01f, 2.5f));
                BoardBuilder.homeB.setLayer("PlaceLayer");
                BoardBuilder.homeB.setLayer(2);
                BoardBuilder.homeB.setColor(DefaultPColor);
                BoardBuilder.homeB.ID = -2;
                key = "Places_B_Home";
                BoardBuilder.homeB.setName(key);
                BoardBuilder.homeB.name = key;
                BoardBuilder.homeB.SetLast();
                BoardBuilder.homeB.AddRigidBody();
                BoardBuilder.homeB.AddCollisator(gamePlay);
                BoardBuilder.Places.Add(key, BoardBuilder.homeB);
            }
            if (id == 12)
            {
                BoardBuilder.homeW.AddOject(PlaceBlock, startPos[j] - step * (i + 1));
                BoardBuilder.homeW.setBoxColleder(new Vector2(0.01f, 0), new Vector2(1.01f, 2.5f));
                BoardBuilder.homeW.setLayer("PlaceLayer");
                BoardBuilder.homeW.setLayer(2);
                BoardBuilder.homeW.setColor(DefaultPColor);
                BoardBuilder.homeW.Revert();
                BoardBuilder.homeW.ID = -2;
                key = "Places_W_Home";
                BoardBuilder.homeW.setName(key);
                BoardBuilder.homeW.name = key;
                BoardBuilder.homeW.SetLast();
                BoardBuilder.homeW.AddRigidBody();
                BoardBuilder.homeW.AddCollisator(gamePlay);
                BoardBuilder.Places.Add(key, BoardBuilder.homeW);
            }
            i++;
            if (i == 6)
            {
                i = 0; j++;
            }
        }
        SetHomeIds();

        SetChips("Places" + 0, PlaseStstus.White);
        SetChips("Places" + 23, PlaseStstus.Black);

        CreateDices();
    }