Exemplo n.º 1
0
 public void resetPlace()
 {
     hasPiece        = false;
     isAnswerInOrder = false;
     piecePlaced     = null;
     GetComponent <SpriteRenderer>().color = Color.white;
 }
Exemplo n.º 2
0
 private void TrimName(PieceBehaviour piece)
 {
     if (piece.gameObject.name.IndexOf(Constants.PieceNames.Clone) > -1)
     {
         piece.gameObject.name = piece.gameObject.name.Substring(0, piece.gameObject.name.IndexOf(Constants.PieceNames.Clone));
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Initializes the game: creates the board, initializes the score variables, calls to shuffle the bags, emits the first piece and starts the bot, if it's the case
    /// If the training is activated, plays it too
    /// </summary>
    void StartGame()
    {
        board        = new TileBehaviour[boardWidth, boardHeight];
        level        = 1;
        linesCleared = score = pieces = 0;
        UpdateUIGameStats();

        TRG.ShuffleBags();

        currentPiece = PieceEmitter.EmitPiece();
        startedGame  = true;

        if (playMode != PlayMode.Player)
        {
            if (playMode != PlayMode.Training)
            {
                if (playMode == PlayMode.Testing)
                {
                    nextActionsTime = initialCalculationTime;
                }
                PlayBot();
            }
            else
            {
                geneticAlgorithm.PlayNextGame();
            }
        }
    }
Exemplo n.º 4
0
 public Piece(PieceBehaviour behaviour, int pieceValue, SquareTableValues values)
 {
     this.behaviour     = behaviour;
     this.pieceValue    = pieceValue;
     this.values        = values;
     this.possibleMoves = new List <Move>();
 }
Exemplo n.º 5
0
    void OnPieceSelected(PieceBehaviour pieceBehaviour)
    {
        Destroy(_torus);

        _selectedPiece = pieceBehaviour == null || _selectedPiece == pieceBehaviour.Piece ? null : pieceBehaviour.Piece;

        DrawSelection();
    }
Exemplo n.º 6
0
 public BlockPiece()
 {
     types = new List <string>()
     {
         "Brick",
     };
     behaviour = PieceBehaviour.STATIC;
 }
Exemplo n.º 7
0
 public ValidPiece()
 {
     types = new List <string>()
     {
         "Red", "Green", "Blue", "Purple"
     };
     behaviour = PieceBehaviour.RELATIVE;
 }
Exemplo n.º 8
0
 public PowerPiece()
 {
     types = new List <string>()
     {
         "OneLine", "OneCollumn", "OneColor", "Diagonal"
     };
     behaviour = PieceBehaviour.RELATIVE;
 }
Exemplo n.º 9
0
    void Update()
    {
        if (GameManager.Instance.GamePaused)
        {
            return;
        }

        PieceBehaviour?.Update(this, Time.deltaTime);
    }
Exemplo n.º 10
0
	public void SetSelectedPiece(PieceBehaviour p)
	{
		if (currentMarkedPiece != null) currentMarkedPiece.Deselect();
		currentMarkedPiece = p;
		currentMarkedPiece.Select();
		hasSelectedPiece = true;

		CheckAvailableMoves();

	}
Exemplo n.º 11
0
    /// <summary>
    /// Gets the next piece from the TetrisRandomGenerator, instantiates it, initializes it and returns it to the TetrisBoardController
    /// </summary>
    public PieceBehaviour EmitPiece()
    {
        PieceType pieceType = TetrisRandomGenerator.Instance.GetNextPiece();

        PieceBehaviour piece = Instantiate(piecePrefab, transform.position, Quaternion.identity, transform).GetComponent <PieceBehaviour>();

        piece.SpawnPiece(pieceType, pieceMaterials[(int)pieceType]);

        return(piece);
    }
Exemplo n.º 12
0
    /// <summary>
    /// Checks if there are lines to clear and if there are, calls to clear that lines
    /// </summary>
    public void CheckLinesToClear()
    {
        //This list will stored the same bool values as rows the board have, and the rows that have to be cleared will be true in this list
        List <bool> linesToClear      = new List <bool>();
        int         firstClearedLine  = -1; //First line that has to be cleared starting from bottom
        int         clearedLinesCount = 0;  //Amount of lines that have to be cleared

        for (int i = 0; i < boardHeight; i++)
        {
            bool toClear = true;
            //If there is any position without a tile, then the row isn't completed
            for (int j = 0; j < boardWidth; j++)
            {
                toClear &= board[j, i];
                if (!toClear)
                {
                    break;
                }
            }

            linesToClear.Add(toClear);
            if (toClear)
            {
                clearedLinesCount++;
                if (firstClearedLine == -1)
                {
                    firstClearedLine = i;
                }
            }
        }

        if (clearedLinesCount > 0)
        {
            UpdateScoreLines(clearedLinesCount);
            ClearLines(linesToClear, firstClearedLine);
        }

        //Next piece is spawned
        currentPiece = PieceEmitter.EmitPiece();
        pieces++;

        UpdateUIGameStats();

        if (playMode == PlayMode.Training && pieceLimitTraining != 0 && pieces > pieceLimitTraining) //In case training is activated and there is a limit of pieces per game, it checks that this limit has been reached
        {
            GameOver();                                                                              //In that case, the game is over
            return;
        }

        //Since this is a method called when a piece is locked in the board, here a new next piece is sent to the bot (if that bot is based in MCTS)
        if (botVersion == BotVersion.MCTSBot)
        {
            ((MCTSTetrisBot)bot).AddNewPiece(TRG.GetLastNextPiece());
        }
    }
Exemplo n.º 13
0
 public static void CorrectVerticalOffsets(PieceBehaviour piece)
 {
     if (!isSpaceship(piece.getPiece()))
     {
         // The Kings and Queens don't have a fancy start animation to get their positions right, so we'll have to do so here
         Vector3 currentPosition = piece.gameObject.GetComponent <Transform>().position;
         piece.gameObject.GetComponent <Transform>().position = new Vector3(currentPosition.x + HardcodedOffset(piece).x,
                                                                            currentPosition.y + HardcodedOffset(piece).y,
                                                                            currentPosition.z + HardcodedOffset(piece).z);
     }
 }
Exemplo n.º 14
0
    public static Vector3 HardcodedOffset(PieceBehaviour piece)
    {
        // Some models are slightly displaced (yet to figure out how to fix this)
        // For now, compute offsets for the Position to coordinate mapping so as to align the model with the square it's on

        if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Pawn && piece.getPiece().side == Side.White)
        {
            // X-wing is displaced on the x-axis by about a 1/8 square
            return(new Vector3(GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>().GetSquareSpacing() / 8, 0, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Knight && piece.getPiece().side == Side.Black)
        {
            // Slave-1 is displaced on the x-axis by about a 1/8 square
            return(new Vector3(GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>().GetSquareSpacing() / 8, 0, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Bishop && piece.getPiece().side == Side.White)
        {
            // Y-wing is displaced on the z-axis by about a quarter square
            return(new Vector3(0, 0, -GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>().GetSquareSpacing() / 4));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Rook && piece.getPiece().side == Side.White)
        {
            // CR-90 Corvette is displaced on the x-axis by about a 1/16 square
            return(new Vector3(GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>().GetSquareSpacing() / 16, 0, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Queen && piece.getPiece().side == Side.Black)
        {
            // Darth Vader is displaced on the y-axis by a certain amount
            return(new Vector3(0, 0.8f - piece.gameObject.GetComponent <Transform>().position.y, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.Queen && piece.getPiece().side == Side.White)
        {
            // Princess Leia is displaced on the y-axis by a certain amount
            return(new Vector3(0, 1.0f - piece.gameObject.GetComponent <Transform>().position.y, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.King && piece.getPiece().side == Side.Black)
        {
            // Darth Sidious is displaced on the y-axis by a certain amount
            return(new Vector3(0, 1.35f - piece.gameObject.GetComponent <Transform>().position.y, 0));
        }
        else if (piece.getPiece().GetType().Name == Constants.PieceClassNames.King && piece.getPiece().side == Side.White)
        {
            // Luke Skywalker is displaced on the y-axis by a certain amount
            return(new Vector3(0, 1.3f - piece.gameObject.GetComponent <Transform>().position.y, 0));
        }
        else
        {
            return(new Vector3(0, 0, 0));
        }
    }
Exemplo n.º 15
0
    public static Vector3 InitializeStartAnimationSettings(PieceBehaviour piece)
    {
        // Also take the liberty of initializing our shaders here, as their utility is somewhat related to the initial animation...

        // Initially, aircraft will be off the board and at a higher elevation than that of the board
        if (!GameKeeper.isDebug)
        {
            if (isSpaceship(piece.getPiece()))
            {
                Vector3 initialTransform = piece.gameObject.GetComponent <Transform>().position;
                int     multiplier;
                if (piece.getPiece().side == Side.Black)
                {
                    multiplier = 1;

                    // The spaceship models are given an opaque shader
                    opaqueBlackMaterial = piece.gameObject.GetComponent <MeshRenderer>().material;
                }
                else
                {
                    multiplier          = -1;
                    opaqueWhiteMaterial = piece.gameObject.GetComponent <MeshRenderer>().material;
                }
                Vector3 finalTransform = new Vector3(initialTransform.x + multiplier * 2, initialTransform.y, initialTransform.z);
                return(finalTransform);
            }
            else
            {
                // Assuming each King/Queen mesh has only one shader since they don't need glass
                Material meshMaterial = piece.gameObject.GetComponent <MeshRenderer>().material;
                if (piece.getPiece().side == Side.Black)
                {
                    // The core piece models are given a fade shader
                    fadeBlackMaterial = meshMaterial;
                }
                else
                {
                    fadeWhiteMaterial = meshMaterial;
                }
                meshMaterial.SetColor("_Color", new Color(meshMaterial.GetColor("_Color").r, meshMaterial.GetColor("_Color").g, meshMaterial.GetColor("_Color").b, 0.0f));
                return(piece.gameObject.GetComponent <Transform>().position);
            }
        }
        else
        {
            return(piece.gameObject.GetComponent <Transform>().position);
        }
    }
Exemplo n.º 16
0
 public void DestroyPiece(PieceBehaviour piece)
 {
     if (Animations.isSpaceship(piece.getPiece()))
     {
         piece.gameObject.GetComponent <ParticleSystem>().Play();
         piece.gameObject.GetComponent <AudioSource>().Play();
         piece.gameObject.GetComponent <MeshRenderer>().enabled = false;
         Destroy(piece.gameObject, piece.gameObject.GetComponent <ParticleSystem>().duration);
     }
     else
     {
         piece.gameObject.GetComponent <ParticleSystem>().Play();
         piece.gameObject.GetComponent <AudioSource>().Play();
         piece.gameObject.GetComponent <MeshRenderer>().enabled = false;
         Destroy(piece.gameObject, piece.gameObject.GetComponent <ParticleSystem>().duration);
     }
 }
Exemplo n.º 17
0
    /// <summary>
    /// Going through the linesToBeClear list, starting from the first one that has to be cleared, some tiles will be deleted and some tiles will be moved properly
    /// </summary>
    /// <param name="lineIndices"></param>
    void ClearLines(List <bool> linesToBeCleared, int firstClearedLine)
    {
        int clearedLines = 0;

        for (int i = firstClearedLine; i < linesToBeCleared.Count; i++)
        {
            if (linesToBeCleared[i])
            {
                clearedLines++;
            }
            else
            {
                for (int j = 0; j < boardWidth; j++)
                {
                    //Moving top tiles to down
                    if (board[j, i] != null)
                    {
                        board[j, i].MoveTile(Vector2Int.down * clearedLines);
                    }

                    //Managing tiles that were in the cleared line
                    if (board[j, i - clearedLines] != null)
                    {
                        PieceBehaviour pB = board[j, i - clearedLines].Piece;
                        pB.tiles[board[j, i - clearedLines].tileIndex] = null;

                        Destroy(board[j, i - clearedLines].gameObject);
                        if (!pB.AnyTilesLeft())
                        {
                            Destroy(pB.gameObject);                     //If all the tiles of a piece are deleted, then the piece GameObject can be deleted as well
                        }
                    }

                    board[j, i - clearedLines] = board[j, i];
                    board[j, i] = null;
                }
            }
        }
    }
Exemplo n.º 18
0
    // Update is called once per frame
    void Update()
    {
        if (!hasPiece)
        {
            for (int i = 0; i < pieces.Length && !hasPiece; i++)
            {
                if (pieces[i].transform.position.x == transform.position.x && pieces[i].transform.position.y == transform.position.y)
                {
                    if (piecePlaced == null && pieces[i].GetComponent <PieceBehaviour>().isPlaced)
                    {
                        hasPiece = true;

                        piecePlaced = pieces[i].GetComponent <PieceBehaviour>();

                        if (piecePlaced.orderInAnswer == orderInQuestion)
                        {
                            isAnswerInOrder = true;
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 19
0
    /// <summary>
    /// First of all, it deletes the tiles of the piece that has caused the game over (it hasn't been locked in the board because there is the possiblity that its tiles occupy positions that are already occupied)
    /// Then, it deletes the tiles of each row of the board passing a short time between them
    /// In case, the game is on bot mode and the weightEvolution bool is true, it will log the needed data in a txt and update the values of the weights
    /// And finally, it starts the game again
    /// </summary>
    /// <param name="lastPieceTiles"></param>
    /// <returns></returns>
    IEnumerator GameOverCoroutine(TileBehaviour[] lastPieceTiles, bool stoppedTesting = false)
    {
        startedGame  = false;
        pausedGame   = false;
        currentPiece = null;

        WaitForSeconds timeBetweenLineRemoving = new WaitForSeconds(0.02f);

        PieceBehaviour pB;

        if (lastPieceTiles != null)
        {
            pB = lastPieceTiles[0].Piece;
            foreach (TileBehaviour tile in lastPieceTiles)
            {
                Destroy(tile.gameObject);
            }
            Destroy(pB.gameObject);

            yield return(timeBetweenLineRemoving);
        }

        for (int i = boardHeight - 1; i >= 0; i--)
        {
            for (int j = 0; j < boardWidth; j++)
            {
                if (board[j, i] != null)
                {
                    pB = board[j, i].Piece;
                    pB.tiles[board[j, i].tileIndex] = null;

                    Destroy(board[j, i].gameObject);

                    if (!pB.AnyTilesLeft())
                    {
                        Destroy(pB.gameObject);
                    }
                }
            }
            yield return(timeBetweenLineRemoving);
        }

        StopAllCoroutines(); //????????

        if (playMode == PlayMode.Training)
        {
            geneticAlgorithm.SetDataFromLastGame(score, pieces, linesCleared, level);

            InitializeGame();
        }
        else
        {
            if (playMode == PlayMode.Testing)
            {
                WriteTestingData(stoppedTesting);
            }

            UIController.ResetButtons();
            UIController.EnableBotSettings(true);
            UIController.EnableWeightFields(true);
        }
    }
Exemplo n.º 20
0
 private void Start()
 {
     pb = GetComponent <PieceBehaviour>();
 }
Exemplo n.º 21
0
    public static void AnimateMovement(PieceBehaviour movingPiece)
    {
        GameKeeper gameKeeper = GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>();

        float finalXPosition = gameKeeper.GetTransformFromPosition(movingPiece.getPiece().GetCurrentPosition()).x + HardcodedOffset(movingPiece).x;
        float finalYPosition = float.Parse(movingPiece.gameObject.GetComponent <MeshRenderer>().bounds.extents.y.ToString("0.00")) + HardcodedOffset(movingPiece).y;
        float finalZPosition = gameKeeper.GetTransformFromPosition(movingPiece.getPiece().GetCurrentPosition()).z + HardcodedOffset(movingPiece).z;

        float lerpSpeed;

        if (gameKeeper.hasGameStarted())
        {
            if (GameObject.Find(Constants.ActionCameraObject).GetComponent <ActionCamera>().isActionCameraEnabled())
            {
                // Nice and slow
                lerpSpeed = 0.02f;
            }
            else
            {
                // No one's gonna wait that long
                lerpSpeed = 0.04f;
            }
        }
        else
        {
            lerpSpeed = 0.025f;
        }

        Vector3 currentLocation = movingPiece.gameObject.GetComponent <Transform>().position;
        Vector3 newLocation;
        bool    stillInMotion = false;

        if (isSpaceship(movingPiece.getPiece()))
        {
            // Fly in, and then land
            if (Mathf.Abs(currentLocation.x - finalXPosition) >= 0.01f || Mathf.Abs(currentLocation.z - finalZPosition) >= 0.01f)
            {
                newLocation = new Vector3(Mathf.Lerp(currentLocation.x, finalXPosition, lerpSpeed),
                                          Mathf.Lerp(currentLocation.y, finalYPosition + 2, lerpSpeed),
                                          Mathf.Lerp(currentLocation.z, finalZPosition, lerpSpeed));
                movingPiece.gameObject.GetComponent <Transform>().position = newLocation;
                stillInMotion = true;
            }
            else if (Mathf.Abs(currentLocation.y - finalYPosition) >= 0.01f)
            {
                newLocation = new Vector3(currentLocation.x,
                                          Mathf.Lerp(currentLocation.y, finalYPosition, lerpSpeed),
                                          currentLocation.z);
                movingPiece.gameObject.GetComponent <Transform>().position = newLocation;
                stillInMotion = true;
            }
        }
        else
        {
            // Fade in like an adept Force user (or rather, Z warrior)
            Material meshMaterial = movingPiece.gameObject.GetComponent <MeshRenderer>().material;
            float    currentAlpha = meshMaterial.GetColor("_Color").a, targetAlpha = 1.0f;
            meshMaterial.SetColor("_Color", new Color(meshMaterial.GetColor("_Color").r, meshMaterial.GetColor("_Color").g, meshMaterial.GetColor("_Color").b, Mathf.Lerp(currentAlpha, targetAlpha, lerpSpeed)));

            // Slide super gracefully
            if (Mathf.Abs(currentLocation.x - finalXPosition) >= 0.01f || Mathf.Abs(currentLocation.z - finalZPosition) >= 0.01f)
            {
                newLocation = new Vector3(Mathf.Lerp(currentLocation.x, finalXPosition, lerpSpeed),
                                          currentLocation.y,
                                          Mathf.Lerp(currentLocation.z, finalZPosition, lerpSpeed));
                movingPiece.gameObject.GetComponent <Transform>().position = newLocation;
                stillInMotion = true;
            }
            else if (Mathf.Abs(currentAlpha - targetAlpha) >= 0.01f)
            {
                stillInMotion = true;
            }
            else if (Mathf.Abs(currentAlpha - targetAlpha) < 0.01f)
            {
                // This case is required to make the pieces opaque
                if (movingPiece.getPiece().side == Side.Black)
                {
                    movingPiece.gameObject.GetComponent <MeshRenderer>().material = opaqueBlackMaterial;
                }
                else
                {
                    movingPiece.gameObject.GetComponent <MeshRenderer>().material = opaqueWhiteMaterial;
                }
            }
        }

        if (!stillInMotion)
        {
            // Ready to roll
            movingPiece.gameObject.GetComponent <PieceBehaviour>().isInAnimationState = false;
            TriggerNextStartAnimation(movingPiece.getPiece());
            if (gameKeeper.hasGameStarted())
            {
                ActionCamera actionCamera = GameObject.Find(Constants.ActionCameraObject).GetComponent <ActionCamera>();
                if (actionCamera.isActionCameraEnabled())
                {
                    actionCamera.EnableMainCamera();
                }

                if (GameObject.Find(Constants.PieceNames.ChessBoard).GetComponent <GameKeeper>().chessBoard.CurrentMovingSide() == movingPiece.getPiece().side)
                {
                    EventManager.TriggerEvent(Constants.EventNames.NewPlayerTurn);
                }
            }
            else
            {
                EventManager.TriggerEvent(Constants.EventNames.PieceSpawned);
            }
        }
    }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes the tile with data of its piece
 /// </summary>
 /// <param name="myPB"></param>
 /// <param name="index"></param>
 public void InitializeTile(PieceBehaviour myPB, int index)
 {
     Piece     = myPB;
     tileIndex = index;
 }
Exemplo n.º 23
0
    // this function loads all the pieces from a vehicle save, along with their behaviour, and also creates the corresponding input and physics data
    public void Load(Transform spawnPoint, bool instantiateBase = true)
    {
        FileStream file = File.Open(MainManager.GetSavePath() + saveName, FileMode.Open);

        if (file == null || !file.CanRead)
        {
            Debug.LogError("COULD NOT OPEN FILE " + MainManager.GetSavePath() + saveName);
            return;
        }

        // we get all pieces prefabs
        GameObject[] basics   = MainManager.GetBasicsPieces();
        GameObject[] movement = MainManager.GetMovementPieces();
        GameObject[] weapons  = MainManager.GetWeaponsPieces();
        GameObject[] misc     = MainManager.GetMiscPieces();

        // we get or init the base
        GameObject baseGO;

        if (instantiateBase)
        {
            baseGO      = Instantiate(MainManager.GetBasePrefab(), spawnPoint.position, spawnPoint.rotation, transform);
            baseGO.name = MainManager.GetBasePrefab().name;
        }
        else
        {
            baseGO = transform.Find("Base").gameObject;
        }

        BinaryReader reader = new BinaryReader(file);

        int       nbPieces = reader.ReadInt32();
        PieceData piece    = new PieceData();

        // init PhysicsData
        physics.hasWheels   = false;
        physics.lowestPiece = baseGO;

        // init InputData
        input.behaviours = new List <PieceBehaviour>();

        for (int index = 0; index < nbPieces; index++)
        {
            // for every piece, we read the data contained in the file
            piece.name       = reader.ReadString();
            piece.position.x = reader.ReadSingle();
            piece.position.y = reader.ReadSingle();
            piece.position.z = reader.ReadSingle();
            piece.rotation.x = reader.ReadSingle();
            piece.rotation.y = reader.ReadSingle();
            piece.rotation.z = reader.ReadSingle();
            piece.rotation.w = reader.ReadSingle();

            bool       instanced = false;
            GameObject go        = null;
            // then we look in every list of pieces until we've found the corresponding one
            // when it is found, we instantiate it
            for (int i = 0; i < basics.Length && !instanced; i++)
            {
                if (basics[i].name == piece.name)
                {
                    go        = Instantiate(basics[i], piece.position, piece.rotation, transform);
                    go.name   = basics[i].name;
                    instanced = true;
                }
            }
            for (int i = 0; i < movement.Length && !instanced; i++)
            {
                if (movement[i].name == piece.name)
                {
                    go                = Instantiate(movement[i], piece.position, piece.rotation, transform);
                    go.name           = movement[i].name;
                    instanced         = true;
                    physics.hasWheels = true;                     // if  the player has at least one engine, it can move
                }
            }
            for (int i = 0; i < weapons.Length && !instanced; i++)
            {
                if (weapons[i].name == piece.name)
                {
                    go        = Instantiate(weapons[i], piece.position, piece.rotation, transform);
                    go.name   = weapons[i].name;
                    instanced = true;
                }
            }
            for (int i = 0; i < misc.Length && !instanced; i++)
            {
                if (misc[i].name == piece.name)
                {
                    go        = Instantiate(misc[i], piece.position, piece.rotation, transform);
                    go.name   = misc[i].name;
                    instanced = true;
                }
            }
            if (instanced)             // set input data
            {
                PieceBehaviour behaviour = go.GetComponent <PieceBehaviour>();
                if (behaviour)                 // if there is a behaviour attached to the piece, we add it to the input data
                {
                    input.behaviours.Add(behaviour);
                }

                if ((go.transform.position.x - physics.lowestPiece.transform.position.x) * (go.transform.position.x - physics.lowestPiece.transform.position.x)
                    + (go.transform.position.z - physics.lowestPiece.transform.position.z) * (go.transform.position.z - physics.lowestPiece.transform.position.z)
                    < 0.1f && go.transform.position.y < physics.lowestPiece.transform.position.y)
                {                             // we check if the instantiated piece is below everything else
                    physics.lowestPiece = go; // if it is, this piece becomes the reference point for the floating effect's raycast
                }
            }
        }

        reader.Close();
        file.Close();
    }
Exemplo n.º 24
0
 public Bishop(PieceBehaviour behaviour, int pieceValue, SquareTableValues values) : base(behaviour, pieceValue, values)
 {
 }