Ejemplo n.º 1
0
        internal void SetWall(int x, int y, MovementDirection md, ConstraintMap.IsWall isWall)
        {
            var tx = x;
            var ty = y;
            var td = md;

            if (td == MovementDirection.EAST)
            {
                tx = x + 1;
                td = MovementDirection.WEST;
            }
            else if (td == MovementDirection.SOUTH)
            {
                ty = y + 1;
                td = MovementDirection.NORTH;
            }

            if (td == MovementDirection.WEST)
            {
                _westWalls [ty, tx] = isWall;
            }
            else if (td == MovementDirection.NORTH)
            {
                _northWalls [ty, tx] = isWall;
            }
        }
Ejemplo n.º 2
0
        internal void ConstrainWalls(int x, int y, int tileIndex)
        {
            //Debug.LogFormat ("Constraining loc {0} {1} tile {2}", x, y, tileIndex);
            List <MovementDirection> moveDirs = new List <MovementDirection> {
                MovementDirection.EAST,
                MovementDirection.NORTH,
                MovementDirection.WEST,
                MovementDirection.SOUTH
            };

            foreach (var md in moveDirs)
            {
                if (GetWall(x, y, md) != ConstraintMap.IsWall.MAYBE)
                {
                    continue;
                }

                bool cm = CanMoveInDirForTileIndex(md, tileIndex);

                ConstraintMap.IsWall isWall = cm ? ConstraintMap.IsWall.NO : ConstraintMap.IsWall.YES;
                SetWall(x, y, md, isWall);
            }
        }
Ejemplo n.º 3
0
        internal void ConstrainLoc(int x, int y, int tileIndex)
        {
            //Debug.LogFormat ("Constraining loc {0} {1} tile {2}", x, y, tileIndex);
            Debug.Assert(_isLocked [y, x] == false);
            _isLocked [y, x] = true;
            _tileSets [y, x] = new List <int> {
                tileIndex
            };

            List <MovementDirection> moveDirs = new List <MovementDirection> {
                MovementDirection.EAST,
                MovementDirection.NORTH,
                MovementDirection.WEST,
                MovementDirection.SOUTH
            };

            foreach (var md in moveDirs)
            {
                bool cm = CanMoveInDirForTileIndex(md, tileIndex);

                ConstraintMap.IsWall isWall = cm ? ConstraintMap.IsWall.NO : ConstraintMap.IsWall.YES;
                SetWall(x, y, md, isWall);
            }
        }