예제 #1
0
    /* #endregion */

    /* #region ---- CreatePitch --------------------------------------------------------------- */
    private void createPitch()
    {
        int pitchWidth  = MatchManager.PitchGrid.PitchSettings.PitchWidth;
        int pitchLength = MatchManager.PitchGrid.PitchSettings.PitchLength;

        setPosOffset(pitchWidth, pitchLength);
        PitchTiles     = new GameObject [pitchWidth + 1, pitchLength + 1];
        PitchTilesList = new List <PitchTile>();

        for (int x = 1; x <= pitchWidth; x++)
        {
            for (int z = 1; z <= pitchLength; z++)
            {
                GameObject pitchTileObj = MatchManager.InstantiateGameObject(returnPitchTilePrefab(x, z));
                pitchTileObj.transform.position = new Vector3(
                    pitchTileObj.transform.position.x - XOffset + x,
                    pitchTileObj.transform.position.y,
                    pitchTileObj.transform.position.z - ZOffset + z);
                pitchTileObj.name = "Pitch tile - " + x + ":" + z;
                pitchTileObj.transform.SetParent(this.transform);

                PitchTile pitchTile = pitchTileObj.GetComponent <PitchTile>();
                pitchTile.SetCoodinates(x, z);
                pitchTile.setUnOccupied();
                pitchTile.InitRotateGridOverlayObjects();
                PitchTiles[x, z] = pitchTileObj;
                PitchTilesList.Add(pitchTile);

                getOutLineTiles(pitchTile, x, z);
            }
        }
    }
예제 #2
0
    /* #endregion */

    /* #region ---- Set a pitchTile instance to unoccupied ------------------------------------ */
    public void setPitchTileUnOccupied(PitchTile pitchTile)
    {
        pitchTile.setUnOccupied();
    }
    /* #endregion */

    /* #region ---- Set Tiles States ---------------------------------------------------------- */
    private void setTilesStates()
    {
        MoveTargetTile.setOccupied(Player);
        MoveSourceTile.setUnOccupied();
        MatchManager.PitchGrid.DeactivateMoveTargetOverlay();
    }