Beispiel #1
0
    public string move()
    {
        transform.Translate(direction * 2f, Space.World);
        num_traversed_squares++;
        string         newLoc = coordinatesToSquare(predictedSquare);
        IList <string> otherStatue_squares_explored = otherStatue.getSquaresExplored();

        if (!squares_explored_list.Contains(newLoc) && !otherStatue_squares_explored.Contains(newLoc))
        {
            squares_explored_list.Add(newLoc);
        }
        Vector3 oldSquare = square;

        square            = predictedSquare;
        predictedSquare.x = 2f * square.x - oldSquare.x;
        predictedSquare.y = 2f * square.y - oldSquare.y;
        return(newLoc);
    }
Beispiel #2
0
    private void tryMove()
    {
        logMoveData();
        bool[] errorsPlayer = getErrorType();
        if (!errorsPlayer[0] && !errorsPlayer[1] && !errorsPlayer[2])
        {
            if (!approximately(prevMoveDir, direction))
            {
                pathTurns++;
                prevMoveDir = direction;
            }
            string newLoc = move();
            moves++;
            countLeftRightSymmetry(newLoc);
            countTopBottomSymmetry(newLoc);
            bool[] errorsBottom = statueArrowBottom.getErrorType();

            if (errorsBottom[1])
            {
                //if there is a statue collision
                statuesCollide++;
                StartCoroutine(collisionHelper(SAB, SAT, SAB.transform.position, SAT.transform.position, 0.1f));
            }
            else if (errorsBottom[2])
            {
                //if there is a statue blocking
                statuesBlockEachOther++;
                StartCoroutine(collisionHelper(SAB, SAT, SAB.transform.position, SAT.transform.position, 0.05f));
            }
            else
            {
                bool[] errorsTop = statueArrowTop.getErrorType();
                if (!errorsBottom[0])
                {
                    //not offscreen
                    string         bottomStatuePredicted         = statueArrowBottom.getPredictedSquare();
                    IList <string> bottomStatue_squares_explored = statueArrowBottom.getSquaresExplored();
                    IList <string> topStatue_squares_explored    = statueArrowTop.getSquaresExplored();
                    if (bottomStatue_squares_explored.Contains(bottomStatuePredicted) || topStatue_squares_explored.Contains(bottomStatuePredicted))
                    {
                        num_repeated_squares_statues++;
                    }
                    else
                    {
                        squares_explored_statues++;
                    }
                    countStatueSymmetry(bottomStatuePredicted);
                    string newLocStatue = statueArrowBottom.move();
                }
                else
                {
                    // tried to move offscreen
                    statueBlockedByOffscreen++;
                }
                if (!errorsTop[0])
                {
                    // not offscreen
                    string         topStatuePredicted            = statueArrowTop.getPredictedSquare();
                    IList <string> bottomStatue_squares_explored = statueArrowBottom.getSquaresExplored();
                    IList <string> topStatue_squares_explored    = statueArrowTop.getSquaresExplored();
                    if (bottomStatue_squares_explored.Contains(topStatuePredicted) || topStatue_squares_explored.Contains(topStatuePredicted))
                    {
                        num_repeated_squares_statues++;
                    }
                    else
                    {
                        squares_explored_statues++;
                    }
                    countStatueSymmetry(topStatuePredicted);
                    string newLocStatue = statueArrowTop.move();
                }
                else
                {
                    // tried to move offscreen
                    statueBlockedByOffscreen++;
                }
            }
        }
        else if (errorsPlayer[1])
        {
            //if player collides with statue (has to be top statue)
            playerStatueCollide++;
            StartCoroutine(collisionHelper(this.gameObject, SAT, transform.position, SAT.transform.position, 0.1f));
        }
        else if (errorsPlayer[2])
        {
            //if player is blocked by a statue (could be either one)
            playerBlockedByStatue++;
            if (predictedSquare == statueArrowBottom.square)
            {
                StartCoroutine(collisionHelperOneSided(this.gameObject, SAB, transform.position, 0.05f));
            }
            else if (predictedSquare == statueArrowTop.square)
            {
                StartCoroutine(collisionHelperOneSided(this.gameObject, SAT, transform.position, 0.05f));
            }
        }
    }