Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        //WALLMOVE
        WallMove wallMove = this.GetComponent <WallMove>();                     //Retrieve the WallMove script.

        wallMove.SetPlayer(this.player);                                        //Share player reference with WallMove script.
        //OVALMOVE
        OvalMove[] ovalMoves = this.GetComponentsInChildren <OvalMove>();       //Retrieve all OvalMove Scripts.
        foreach (OvalMove o in ovalMoves)                                       //Share player reference with each OvalMove script.
        {
            o.SetPlayer(this.player);
        }
    }
Пример #2
0
        private bool ValidateWallMove(WallMove wallMove)
        {
            UndoSpecialEdges();

            if (!IsWallApplyable(wallMove))
            {
                return(false);
            }

            ApplyWall(wallMove.PlacedWall);

            AddSpecialEdges();

            return(TraverseGraph(GetNode(topPlayerPosition), YField.One) &&
                   TraverseGraph(GetNode(bottomPlayerPosition), YField.Nine));
        }
Пример #3
0
        private bool IsWallApplyable(WallMove wallMove)
        {
            var wall = wallMove.PlacedWall;

            var topleft     = wall.TopLeft;
            var bottomLeft  = topleft.GetBottom();
            var topRight    = topleft.GetRight();
            var bottomRight = topRight.GetBottom();

            if (wall.Orientation == WallOrientation.Horizontal)
            {
                return(Nodes[topleft].Bottom != null &&
                       Nodes[bottomLeft].Top != null &&
                       Nodes[topRight].Bottom != null &&
                       Nodes[bottomRight].Top != null);
            }
            else
            {
                return(Nodes[topleft].Right != null &&
                       Nodes[bottomLeft].Right != null &&
                       Nodes[topRight].Left != null &&
                       Nodes[bottomRight].Left != null);
            }
        }