示例#1
0
    public void PopulateGrid(int height, int width, float offset)            //this populates the grid, this is the meat and potatoes of this script
    {
        myGridPieces = new GridPiece[height, width];                         //first we make a multidimensional array that is the width and depth of the grid, which we fill as we spawn

        for (int gridY = 0; gridY < height; gridY++)                         //for each row(depth)
        {
            GameObject myParent = new GameObject();                          //make a row object
            myParent.transform.SetParent(this.transform);                    //set it's parent as the grid
            myParent.transform.name = "Row" + gridY.ToString();              //name it a row + the row number we are on
            for (int gridX = 0; gridX < width; gridX++)                      //for each row, for each width in that row
            {
                GameObject workingGO = new GameObject();                     //make an empty object
                GridPiece  thisPiece = workingGO.AddComponent <GridPiece>(); //add a gridpiece component to it

                // myGridPieceComponenets.Add(thisPiece);
                myGridPieces[gridY, gridX] = thisPiece; //set the variable of this position in the multidimensional array to this

                //    myGridPieceComponenets.Add(myGridPieces[gridY, gridX]);
                workingGO.transform.SetParent(myParent.transform);                                    //set the parent of this as the row it is in
                workingGO.transform.position = new Vector3(gridX * offset, 0f, gridY * offset * -1f); //offset the gridpiece in X and Y, multiplied by offset (we could move the row(parent object) in the Y and then only change the local transform of this object, but I like this more
                workingGO.transform.name     = "GridPiece " + gridX.ToString();                       //name the object for which position it is in the X
                thisPiece.Init(PrefabLib.getLibrary.GetGridPeice, gridY, gridX);                      //Initilize the gridpiece, we feed in our gridpeice base object from our prefab library
                AddToGrid(thisPiece);
                //thisPiece.myColor = new Color(gridX * 0.1f, 0.2f, gridY * 0.1f); //right now im just changing the color for testing
                //myGridPieceComponenets.Add(thisPiece);
            }
        }
    }
 public void ShowParticle(GridPiece explodedPiece)
 {
     if (explodedPiece.GetComponent <IColored> () != null)
     {
         Instantiate(PieceParticlePrefab).GetComponent <PieceParticle> ().ShowParticle(explodedPiece.transform.position + Vector3.back, Colors [explodedPiece.GetComponent <IColored> ().ColorIndexOfThisPiece]);
     }
 }
 GridPiece[,] doSmoothing(GridPiece[,] oldMap)
 {
     GridPiece[,] newMap = new GridPiece[width, height];
     for (int x = 0; x < oldMap.GetLength(0); x++)
     {
         for (int y = 0; y < oldMap.GetLength(1); y++)
         {
             int neighbours = countNeighbours(oldMap, x, y);
             if (oldMap [x, y] == GridPiece.Wall)
             {
                 if (neighbours < deathLimit)
                 {
                     newMap [x, y] = GridPiece.None;
                 }
                 else
                 {
                     newMap [x, y] = GridPiece.Wall;
                 }
             }
             else
             {
                 if (neighbours > birthLimit)
                 {
                     newMap [x, y] = GridPiece.Wall;
                 }
                 else
                 {
                     newMap [x, y] = GridPiece.None;
                 }
             }
         }
     }
     return(newMap);
 }
示例#4
0
    public void breakPeice(GameObject go)
    {
        GridPiece gp = go.GetComponent <GridPiece>();

        gp.place(false);
        Destroy(gp.getPlacedGameObject());
    }
示例#5
0
 public override void Click(float mouseX, float mouseY, int gridX, int gridY, Grid grid, GridPiece piece)
 {
     if (piece == null)
     {
         grid.AddPiece(new Relay(), gridX, gridY);
     }
 }
示例#6
0
 public override void Click(float mouseX, float mouseY, int gridX, int gridY, Grid grid, GridPiece piece)
 {
     if (piece == null)
     {
         grid.AddPiece(new Battery(new ChargeColor(R, G, B)), gridX, gridY);
     }
 }
示例#7
0
 public void SpawnBlockage(Grid myGrid, Vector2[] locations)
 {
     for (int point = 0; point < locations.Length; point++)
     {
         GridPiece curPiece = myGrid.getGridPiece(Mathf.FloorToInt(locations[point].x), Mathf.FloorToInt(locations[point].y));
         curPiece.PlaceGridPiece(PrefabLib.getLibrary.Blockage);
     }
 }
示例#8
0
 public void AddToGrid(GridPiece thingToAdd)
 {
     if (myGridPieceComponenets == null)
     {
         myGridPieceComponenets = new List <GridPiece>();
     }
     myGridPieceComponenets.Add(thingToAdd);
 }
示例#9
0
文件: Room.cs 项目: alect/Puzzledice
 public void addPiece(GridPiece piece, Vector2 gridPos)
 {
     Vector2 actualPos = PlayState.instance.toActualCoordinates(gridPos);
     piece.transform.parent = PlayState.instance.transform;
     piece.x = actualPos.x;
     piece.y = actualPos.y;
     piece.init();
     _gridPieces.Add(piece);
 }
示例#10
0
 public void LinkPiece(GridPiece piece)
 {
     m_Pieces.Add(piece);
     m_Coordinates.AddRange(piece.m_Coordinates);
     m_Pieces.ForEach((GridPiece p) =>
     {
         p.PopulateCoords(this);
     });
 }
示例#11
0
 /// <summary>
 /// Destroies the exploded grid pieces.
 /// </summary>
 /// <param name="item">İtem.</param>
 static void destroyExplodedGridPieces(IndexGroup item)
 {
     for (int i = item.Values.Count - 1; i >= 0; i--)
     {
         GridPiece temp = GridSystem.GridMap [item.Values [i]];
         GridSystem.GridMap.RemoveAt(item.Values [i]);
         GameObject.Destroy(temp.gameObject);
     }
 }
示例#12
0
    private void Awake()
    {
        var startPiece = GridPiece.GeneratePiece(this, new Square());

        startPiece.Place(Vector2.zero);

        m_FinalPiece = GridPiece.GeneratePiece(this, new Square());
        m_FinalPiece.Place(new Vector2(0, m_Distance));
    }
示例#13
0
 private void performTurnMovement(GridPiece piece)
 {
     if (piece.nextPoint != piece.gridPos)
     {
         float   moveSpeed       = Globals.MOVE_SPEED;
         Vector2 nextActualPoint = toActualCoordinates(piece.nextPoint);
         piece.moveToPoint(nextActualPoint, moveSpeed);
     }
 }
示例#14
0
    /*
     * public bool hasNeighbor(int xPos, int yPos)
     * {
     *  bool returnBool = false;
     *  if(((xPos > 0)&&(xPos < myGridPieces.GetLength(1))) && ((yPos > 0)&& (yPos < myGridPieces.GetLength(0)))){
     *      returnBool = true;
     *  }
     *  else
     *  {
     *      returnBool = false;
     *  }
     *  return returnBool;
     * }
     */

    public GridPiece getGridPiece(int xPos, int yPos)
    {
        GridPiece returnPiece = null;

        if (((xPos >= 0) && (xPos < myGridPieces.GetLength(1))) && ((yPos >= 0) && (yPos < myGridPieces.GetLength(0))))
        {
            returnPiece = myGridPieces[yPos, xPos];
        }
        return(returnPiece);
    }
示例#15
0
 /// <summary>
 /// İnserts the ın the top of the stun.
 /// </summary>
 /// <param name="count">Count.</param>
 /// <param name="insertIndex">İnsert ındex.</param>
 /// <param name="enTepePos">En tepe position.</param>
 static void insertInTheTopOfTheStun(int count, int insertIndex, Vector2 enTepePos)
 {
     for (int i = 0; i < count; i++)
     {
         GridPiece temp = GameSkeleton.gridSystem.InstantiateGridPiece();
         temp.transform.position = new Vector2(enTepePos.x, enTepePos.y + (GameSkeleton.gridSystem.yPlusPos * i) + 5f);
         GridSystem.GridMap.Insert(insertIndex + i, temp);
         GameSkeleton.gridSystem.GiveAColorToTheCreatedHexagonalPiece(temp, true);
     }
 }
示例#16
0
文件: Room.cs 项目: nixlim/Puzzledice
    public void addPiece(GridPiece piece, Vector2 gridPos)
    {
        Vector2 actualPos = PlayState.instance.toActualCoordinates(gridPos);

        piece.transform.parent = PlayState.instance.transform;
        piece.x = actualPos.x;
        piece.y = actualPos.y;
        piece.init();
        _gridPieces.Add(piece);
    }
示例#17
0
文件: Room.cs 项目: nixlim/Puzzledice
    public void addSpikes()
    {
        int numSpikes = Random.Range(MIN_SPIKES, MAX_SPIKES + 1);

        for (int i = 0; i < numSpikes; i++)
        {
            GameObject newSpike = GameObject.Instantiate(PlayState.instance.spikePrefab) as GameObject;
            newSpike.transform.parent = PlayState.instance.transform;
            GridPiece spike = newSpike.GetComponent <GridPiece>();
            addPiece(spike);
        }
    }
示例#18
0
文件: Room.cs 项目: nixlim/Puzzledice
    public void addGoblins()
    {
        int numGoblins = Random.Range(MIN_GOBLINS, MAX_GOBLINS + 1);

        for (int i = 0; i < numGoblins; i++)
        {
            GameObject newGoblin = GameObject.Instantiate(PlayState.instance.goblinPrefab) as GameObject;
            newGoblin.transform.parent = PlayState.instance.transform;
            GridPiece goblin = newGoblin.GetComponent <GridPiece>();
            addPiece(goblin);
        }
    }
示例#19
0
文件: Room.cs 项目: nixlim/Puzzledice
    protected void addCosmeticWalls()
    {
        int numWalls = Random.Range(MIN_COSMETIC_WALLS, MAX_COSMETIC_WALLS + 1);

        for (int i = 0; i < numWalls; i++)
        {
            GameObject newWall = GameObject.Instantiate(PlayState.instance.wallPrefab) as GameObject;
            newWall.transform.parent = PlayState.instance.transform;
            GridPiece wallPiece = newWall.GetComponent <GridPiece>();
            addPiece(wallPiece);
        }
    }
示例#20
0
 public void performPieceTurn(GridPiece piece)
 {
     if (!piece.turnPerformed)
     {
         piece.turnPerformed = true;
         piece.performTurn();
         if (inGrid(piece.nextPoint))
         {
             _claimedGrid[(int)piece.nextPoint.x, (int)piece.nextPoint.y].Add(piece);
         }
     }
 }
示例#21
0
    public static GridPiece GeneratePiece(WorldGrid grid, Shape shapeOverride = null)
    {
        Shape shape = shapeOverride;

        if (shape == null)
        {
            shape = Shape.RandomShape();
        }

        GridPiece newPiece = new GridPiece(grid, shape);

        return(newPiece);
    }
示例#22
0
 /// <summary>
 /// Visuals the process ın the exploding groups.
 /// </summary>
 /// <param name="explodingGroups">Exploding groups.</param>
 static void visualProcessInTheExplodingGroups(List <IndexGroup> explodingGroups)
 {
     for (int i = 0; i < explodingGroups.Count; i++)
     {
         for (int b = 0; b < explodingGroups [i].Values.Count; b++)
         {
             GridPiece tempPieceRef = GridSystem.GridMap [explodingGroups [i].Values [b]];
             //Tüm hepsini kaldırmadan önce kapatıp, görsele başla ve hesaplamaları çalıştır
             GameSkeleton.particleManager.ShowParticle(tempPieceRef);
             tempPieceRef.gameObject.SetActive(false);
         }
         Stats.scoreSystem.GroupExplodedAddScoreAndShowPlayer(explodingGroups [i].Values.Count, (Vector3)(explodingGroups [i].GiveMiddlePointOfIndexGroup()) + Vector3.back);
     }
 }
示例#23
0
    public List <CoordinateRepresentation> RepresentPiece(GridPiece newPiece)
    {
        List <CoordinateRepresentation> reps = new List <CoordinateRepresentation>();

        newPiece.m_Coordinates.ForEach((Coordinate coordinate) =>
        {
            var coordinateRepGO = GameObject.Instantiate(m_CoordinatePrefab);
            var rep             = coordinateRepGO.GetComponent <CoordinateRepresentation>();
            reps.Add(rep);
            rep.Configure(coordinate);
        });

        return(reps);
    }
示例#24
0
文件: Room.cs 项目: nixlim/Puzzledice
    public void addPiece(GridPiece piece)
    {
        piece.init();

        uint[,] typeGrid = new uint[Globals.ROOM_WIDTH, Globals.ROOM_HEIGHT];
        for (int i = 0; i < Globals.ROOM_WIDTH; i++)
        {
            for (int j = 0; j < Globals.ROOM_HEIGHT; j++)
            {
                typeGrid[i, j] = 0;
            }
        }
        foreach (GridPiece existingPiece in _gridPieces)
        {
            typeGrid[(int)existingPiece.gridPos.x, (int)existingPiece.gridPos.y] = existingPiece.type;
        }

        // If the piece is not a wall, can insert it in any spot.
        if (!piece.hasType(GridPiece.WALL_TYPE))
        {
            List <Vector2> emptyTiles = getEmptyTiles(typeGrid);
            if (emptyTiles.Count == 0)
            {
                throw new UnityException("Overflow in room!");
            }
            Vector2 tile      = Globals.getRandom(emptyTiles);
            Vector2 actualPos = PlayState.instance.toActualCoordinates(tile);
            piece.transform.parent = PlayState.instance.transform;
            piece.x = actualPos.x;
            piece.y = actualPos.y;
            _gridPieces.Add(piece);
        }
        // Otherwise, have to make sure it's not next to a wall or edge.
        else
        {
            List <Vector2> spaciousTiles = getSpaciousTiles(typeGrid);
            if (spaciousTiles.Count == 0)
            {
                throw new UnityException("Overflow in room!");
            }
            Vector2 tile      = Globals.getRandom(spaciousTiles);
            Vector2 actualPos = PlayState.instance.toActualCoordinates(tile);
            piece.transform.parent = PlayState.instance.transform;
            piece.x = actualPos.x;
            piece.y = actualPos.y;
            _gridPieces.Add(piece);
        }
        piece.resetGridPos();
    }
示例#25
0
文件: Room.cs 项目: nixlim/Puzzledice
    protected void makeEmptyRoom()
    {
        // First thing to do is create wall tiles around the border
        for (int i = 0; i < Globals.ROOM_WIDTH; i++)
        {
            // Make a wall along the horizontal edges
            GameObject wallObj = GameObject.Instantiate(PlayState.instance.wallPrefab) as GameObject;
            wallObj.transform.parent = PlayState.instance.transform;
            GridPiece wallPiece = wallObj.GetComponent <GridPiece>();
            wallPiece.x = Globals.CELL_SIZE * i + Globals.CELL_SIZE / 2;
            wallPiece.y = Globals.CELL_SIZE / 2;

            wallPiece.init();
            _gridPieces.Add(wallPiece);

            wallObj = GameObject.Instantiate(PlayState.instance.wallPrefab) as GameObject;
            wallObj.transform.parent = PlayState.instance.transform;
            wallPiece   = wallObj.GetComponent <GridPiece>();
            wallPiece.x = Globals.CELL_SIZE * i + Globals.CELL_SIZE / 2;
            wallPiece.y = Globals.CELL_SIZE * (Globals.ROOM_HEIGHT - 1) + Globals.CELL_SIZE / 2;

            wallPiece.init();
            _gridPieces.Add(wallPiece);
        }
        for (int i = 1; i < Globals.ROOM_HEIGHT - 1; i++)
        {
            // Make a wall along the horizontal edges
            GameObject wallObj = GameObject.Instantiate(PlayState.instance.wallPrefab) as GameObject;
            wallObj.transform.parent = PlayState.instance.transform;
            GridPiece wallPiece = wallObj.GetComponent <GridPiece>();
            wallPiece.y = Globals.CELL_SIZE * i + Globals.CELL_SIZE / 2;
            wallPiece.x = Globals.CELL_SIZE / 2;

            wallPiece.init();
            _gridPieces.Add(wallPiece);

            wallObj = GameObject.Instantiate(PlayState.instance.wallPrefab) as GameObject;
            wallObj.transform.parent = PlayState.instance.transform;
            wallPiece   = wallObj.GetComponent <GridPiece>();
            wallPiece.y = Globals.CELL_SIZE * i + Globals.CELL_SIZE / 2;
            wallPiece.x = Globals.CELL_SIZE * (Globals.ROOM_WIDTH - 1) + Globals.CELL_SIZE / 2;

            wallPiece.init();
            _gridPieces.Add(wallPiece);
        }
    }
示例#26
0
    void Update()
    {
        if (gridPiece)
        {
            gridPiece.Hover = false;
            gridPiece = null;
        }

        Vector3 mousePos = Input.mousePosition;

        Ray ray;
        RaycastHit hit;

        ray = textureCamera.ScreenPointToRay(mousePos);

        if (Physics.Raycast(ray, out hit) && hit.transform.tag == "PixelRenderQuad")
        {
            #if UNITY_EDITOR
                Debug.DrawLine(ray.origin, hit.point);
            #endif

            ray = gameCamera.ViewportPointToRay(hit.textureCoord);
            if(Physics.Raycast(ray, out hit))
            {
                #if UNITY_EDITOR
                    Debug.DrawLine(ray.origin, hit.point);
                #endif

                //if hover over grid piece
                if(hit.transform.tag == "Grid")
                {
                    hit.transform.gameObject.GetComponent<GridPiece>().Hover = true;
                    gridPiece = hit.transform.gameObject.GetComponent<GridPiece>();

                    if (Input.GetMouseButtonUp(0))
                    {
                        gridPiece.AddTowerBase();
                    }

                }
            }
        }
    }
示例#27
0
文件: Room.cs 项目: alect/Puzzledice
    public void addPiece(GridPiece piece)
    {
        piece.init();

        uint[,] typeGrid = new uint[Globals.ROOM_WIDTH, Globals.ROOM_HEIGHT];
        for (int i = 0; i < Globals.ROOM_WIDTH; i++) {
            for (int j = 0; j < Globals.ROOM_HEIGHT; j++) {
                typeGrid[i, j] = 0;
            }
        }
        foreach (GridPiece existingPiece in _gridPieces) {
            typeGrid[(int)existingPiece.gridPos.x, (int)existingPiece.gridPos.y] = existingPiece.type;
        }

        // If the piece is not a wall, can insert it in any spot.
        if (!piece.hasType(GridPiece.WALL_TYPE)) {
            List<Vector2> emptyTiles = getEmptyTiles(typeGrid);
            if (emptyTiles.Count == 0)
                throw new UnityException("Overflow in room!");
            Vector2 tile = Globals.getRandom(emptyTiles);
            Vector2 actualPos = PlayState.instance.toActualCoordinates(tile);
            piece.transform.parent = PlayState.instance.transform;
            piece.x = actualPos.x;
            piece.y = actualPos.y;
            _gridPieces.Add(piece);
        }
        // Otherwise, have to make sure it's not next to a wall or edge.
        else {
            List<Vector2> spaciousTiles = getSpaciousTiles(typeGrid);
            if (spaciousTiles.Count == 0)
                throw new UnityException("Overflow in room!");
            Vector2 tile = Globals.getRandom(spaciousTiles);
            Vector2 actualPos = PlayState.instance.toActualCoordinates(tile);
            piece.transform.parent = PlayState.instance.transform;
            piece.x = actualPos.x;
            piece.y = actualPos.y;
            _gridPieces.Add(piece);
        }
        piece.resetGridPos();
    }
示例#28
0
    public void GiveAColorToTheCreatedHexagonalPiece(GridPiece gridPiece, bool random)
    {
        IColored cPiece = gridPiece.GetComponent <IColored> ();

        if (cPiece == null)
        {
            return;
        }
        int stunIndex  = (GridMap.Count - 1).GetColumnOfIndex(gridYLength);
        int satırIndex = (GridMap.Count - 1).GetRowOfIndex(gridYLength);

        if (random || (stunIndex == 0) || ((stunIndex % 2 != 0) && (satırIndex == 0)))
        {
            int cI = Random.Range(0, colors.Length);
            cPiece.ChangeColor(cI, colors [cI]);
            return;
        }
        List <IndexGroup> groupHolder = SelectableTrianglesOfaGridPiece(gridPiece);
        int randomColorIndex          = Random.Range(0, colors.Length);

        cPiece.ColorIndexOfThisPiece = randomColorIndex;
        if (groupHolder.CheckForGroupElementsHaveAGivenCountOfDifferentColor(1) == true)
        {
            for (int i = 0; i < colors.Length - 1; i++)
            {
                randomColorIndex++;
                if (randomColorIndex >= colors.Length)
                {
                    randomColorIndex -= colors.Length;
                }
                cPiece.ColorIndexOfThisPiece = randomColorIndex;
                if (groupHolder.CheckForGroupElementsHaveAGivenCountOfDifferentColor(1) == false)
                {
                    break;
                }
            }
        }
        cPiece.ChangeColor(randomColorIndex, colors [randomColorIndex]);
        return;
    }
示例#29
0
    /// <summary>
    /// Turns the selected ındexes ın grid system.
    /// </summary>
    /// <param name="angleDir">Angle dir.</param>
    public override void TurnSelectedIndexesInGridSystem(int angleDir)
    {
        IndexGroup tempProcessList = new IndexGroup(GameSkeleton.selectorManager.SelectedPieceGroup);

        tempProcessList.Values.Sort();
        GridPiece low  = GridSystem.GridMap [tempProcessList.Values [0]],
                  mid  = GridSystem.GridMap [tempProcessList.Values [1]],
                  high = GridSystem.GridMap [tempProcessList.Values [2]];

        if (angleDir == -1)          //clockwise
        {
            GridSystem.GridMap [tempProcessList.Values [0]] = mid;
            GridSystem.GridMap [tempProcessList.Values [1]] = high;
            GridSystem.GridMap [tempProcessList.Values [2]] = low;
        }
        else            //counter-clockwise
        {
            GridSystem.GridMap [tempProcessList.Values [0]] = high;
            GridSystem.GridMap [tempProcessList.Values [1]] = low;
            GridSystem.GridMap [tempProcessList.Values [2]] = mid;
        }
    }
示例#30
0
    public IndexGroup GiveClosestIndexesOfAGridPieceInGridSystem(GridPiece ClickedPiece, Vector3 Pos, int countToGive)
    {
        IndexGroup selectedIndexex = new IndexGroup();

        List <GridPiece> excludedPieces = new List <GridPiece> ();

        excludedPieces.Add(ClickedPiece);
        Vector2 mPoint = (new List <Vector2>(new Vector2[] { Pos, ClickedPiece.transform.position })).giveMiddePointOfVectors();

        for (int i = 0; i < countToGive; i++)
        {
            int   closestIndex = 0;
            float closestPoint = 100f;
            for (int b = 0; b < GridMap.Count; b++)
            {
                if (!excludedPieces.Contains(GridMap [b]))
                {
                    if (Vector2.Distance(GridMap [b].transform.position, mPoint) < closestPoint)
                    {
                        closestIndex = b;
                        closestPoint = Vector2.Distance(GridMap [b].transform.position, mPoint);
                    }
                }
            }
            selectedIndexex.Values.Add(closestIndex);
            excludedPieces.Add(GridMap [closestIndex]);
            List <Vector2> tempArray = new List <Vector2> (new Vector2[] { Pos, ClickedPiece.transform.position });
            for (int c = 0; c < excludedPieces.Count; c++)
            {
                tempArray.Add(excludedPieces [c].transform.position);
            }
            mPoint = tempArray.giveMiddePointOfVectors();
        }

        selectedIndexex.Values.Add(GridIndexOfaPiece(ClickedPiece));
        return(selectedIndexex);
    }
示例#31
0
    void gridCreation()
    {
        oneSideScale = gridYLength < gridXLength + 2 ? findOneSideScaleOfPieceObjects(gridXLength) : findOneSideScaleOfPieceObjects(gridYLength);
        giveScalesOfPieces();
        xPlusPos = oneSideScale / 2f + oneSideScale / 4f;
        yPlusPos = 2f * oneSideScale / 4f * Mathf.Sqrt(3f);
        OffsetY  = (gridYLength * yPlusPos + (yPlusPos / 2f)) * oneSideScale / 2f;
        OffsetX  = ((gridXLength * (3f * oneSideScale / 4f) + oneSideScale / 4f) - oneSideScale) / 2f;
        Vector3 position = Vector3.zero, rotation = HexagonalPiecePrefab.transform.rotation.eulerAngles;

        GridMap = new List <GridPiece> ();
        for (int i = 0; i < gridXLength; i++)
        {
            for (int b = 0; b < gridYLength; b++)
            {
                position = GiveThePositionOfGridIndex((gridYLength * i) + b);
                GridPiece gridPiece = InstantiateGridPiece();
                GridMap.Add(gridPiece);
                gridPiece.transform.localPosition = position;
                gridPiece.transform.rotation      = Quaternion.Euler(rotation);
                GiveAColorToTheCreatedHexagonalPiece(gridPiece, false);
            }
        }
    }
示例#32
0
 public void performPieceTurn(GridPiece piece)
 {
     if (!piece.turnPerformed) {
         piece.turnPerformed = true;
         piece.performTurn();
         if (inGrid(piece.nextPoint))
             _claimedGrid[(int)piece.nextPoint.x, (int)piece.nextPoint.y].Add(piece);
     }
 }
示例#33
0
 public int GridIndexOfaPiece(GridPiece piece)
 {
     return(GridMap.FindIndex(x => x == piece));
 }
示例#34
0
 public Coordinate(GridPiece piece, Vector2 position)
 {
     m_Position = position;
     m_Piece    = piece;
 }
示例#35
0
 public abstract void Click(float mouseX, float mouseY, int gridX, int gridY, Grid grid, GridPiece piece);
示例#36
0
 public void removeFromGrid(GridPiece item)
 {
     _piecesToRemove.Add(item);
 }
示例#37
0
 public void removeFromGame(GridPiece item)
 {
     _piecesToRemove.Add(item);
     _piecesToDestroy.Add(item);
 }
示例#38
0
 public void removeFromGame(GridPiece item)
 {
     _piecesToRemove.Add(item);
     _piecesToDestroy.Add(item);
 }
示例#39
0
 public void removeFromGrid(GridPiece item)
 {
     _piecesToRemove.Add(item);
 }
示例#40
0
 private void performTurnMovement(GridPiece piece)
 {
     if (piece.nextPoint != piece.gridPos) {
         float moveSpeed = Globals.MOVE_SPEED;
         Vector2 nextActualPoint = toActualCoordinates(piece.nextPoint);
         piece.moveToPoint(nextActualPoint, moveSpeed);
     }
 }