本文整理汇总了C#中GameBoard.isGridPositionOpen方法的典型用法代码示例。如果您正苦于以下问题:C# GameBoard.isGridPositionOpen方法的具体用法?C# GameBoard.isGridPositionOpen怎么用?C# GameBoard.isGridPositionOpen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameBoard
的用法示例。
在下文中一共展示了GameBoard.isGridPositionOpen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
//.........这里部分代码省略.........
myPath[6] = new Vector2(8, 4);
myPath[7] = new Vector2(8, 12);
myPath[0] = new Vector2(8, 19);
myPath[1] = new Vector2(17, 19);
myPath[2] = new Vector2(25, 19);
myPath[3] = new Vector2(25, 12);
myPath[4] = new Vector2(25, 4);
myPath[5] = new Vector2(17, 4);
followerZombies.Add(new CongaFollowerZombie(8, 12, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(8, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
myPath = new Vector2[8];
myPath[3] = new Vector2(8, 4);
myPath[4] = new Vector2(8, 12);
myPath[5] = new Vector2(8, 19);
myPath[6] = new Vector2(17, 19);
myPath[7] = new Vector2(25, 19);
myPath[0] = new Vector2(25, 16);
myPath[1] = new Vector2(25, 4);
myPath[2] = new Vector2(17, 4);
followerZombies.Add(new CongaFollowerZombie(29, 17, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(29, 15, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(29, 16, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(29, 13, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
myPath = new Vector2[8];
myPath[7] = new Vector2(8, 4);
myPath[0] = new Vector2(8, 7);
myPath[1] = new Vector2(8, 19);
myPath[2] = new Vector2(17, 19);
myPath[3] = new Vector2(25, 19);
myPath[4] = new Vector2(25, 12);
myPath[5] = new Vector2(25, 4);
myPath[6] = new Vector2(17, 4);
followerZombies.Add(new CongaFollowerZombie(4, 7, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(4, 9, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(4, 8, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
followerZombies.Add(new CongaFollowerZombie(4, 10, board.getNumSquaresX(), 0, board.getNumSquaresY(), 0, myPath,leaderZombie, darwin, board));
leaderZombie.setFollowers(followerZombies);
String zombieString = "This a zombie,\n don't near him \nas a human!!";
zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);
String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);
String switchString = "This is a switch\n face it and press A\n to see what happens!!";
switchMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, switchString);
stairs = new Stairs(board);
BasicObject[] removableWalls = setRemovableWallsSwitchOne();
BasicObject switchSquare = new BasicObject(board);
switchSquare.X = 31;
switchSquare.Y = 8;
firstSwitch = new Switch(switchSquare, board, removableWalls);
BasicObject[] removableWalls2 = setRemovableWallsSwitchTwo();
BasicObject switchSquare2 = new BasicObject(board);
switchSquare2.X = 1;
switchSquare2.Y = 15;
secondSwitch = new Switch(switchSquare2, board, removableWalls2);
// Initial starting position
darwin.setGridPosition(16, 22);
if (board.isGridPositionOpen(darwin))
{
board.setGridPositionOccupied(darwin.X, darwin.Y);
darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
}
// Darwin's lag movement
counterReady = counter = 5;
if (board.isGridPositionOpen(16, 1))
{
stairs.setGridPosition(16, 1);
stairs.setDestination(board.getPosition(16, 1));
}
zTime = new ZombieTime(board);
zTimeReset = new ZombieTime(board);
setPotionPosition(28, 7);
setPotion2Position(1, 7);
setWallsInLevelFour();
setDanceFloor();
}
示例2: Zombie
/* constructor
* sets an initial area for the zombie to take up
* mymaxX, myminX are the max/min allowed horizontal range for the zombie
* mymaxY, myminY are the max/min allowed vertical range for the zombie
* Gameboard myboard -- the board which the zombie is moving on
**/
public Zombie(int startX, int startY, int mymaxX, int myminX, int mymaxY, int myminY, GameBoard myboard)
: base(myboard)
{
maxX = mymaxX;
maxY = mymaxY;
minX = myminX;
minY = myminY;
// start with no zombie vision
allowVision = false;
visionMaxX = 3;
visionMaxY = 3;
isAlive = true;
allowRangeDetection = true;
board = myboard;
this.X = startX;
this.Y = startY;
if (board.isGridPositionOpen(this))
{
board.setGridPositionOccupied(this.X, this.Y);
this.destination = board.getPosition(X, Y);
}
source = new Rectangle(0, 0, ZOMBIE_WIDTH, ZOMBIE_HEIGHT);
enemyAlert = false;
}
示例3: Initialize
public void Initialize()
{
gameOverPosition.X = 320;
gameOverPosition.Y = 130;
device = graphics.GraphicsDevice;
gameState = new GameState();
gameStart = new GameStart(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight);
gameState.setState(GameState.state.Level);
board = new GameBoard(new Vector2(33, 25), new Vector2(device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight));
darwin = new Darwin(board);
String zombieString = "This a zombie,\n don't near him \nas a human!!";
zombieMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, zombieString);
String darwinString = "This is darwin,\n move with arrows, \n z to transform, \n a for actions";
darwinMessage = new MessageBox(board.getPosition(12, 8).X, board.getPosition(10, 10).Y, darwinString);
stairs = new Stairs(board);
if (board.isGridPositionOpen(5, 18))
{
stairs.setGridPosition(5, 18);
}
// Initial starting position
darwin.setGridPosition(6, 18);
if (board.isGridPositionOpen(darwin))
{
board.setGridPositionOccupied(darwin.X, darwin.Y);
darwin.setPosition(board.getPosition(darwin).X, board.getPosition(darwin).Y);
}
// Darwin's lag movement
counterReady = counter = 5;
zTime = new ZombieTime(board);
zTimeReset = new ZombieTime(board);
setPotionPosition(27, 5);
setBoxes();
setBoxPattern();
pattern = new BoxPattern(board, spotsForPattern);
setVortexes();
setWalls();
snake = new Snake(10, 9, 27, 5, 18, 5, board);
snake2 = new Snake(8, 15, 27, 5, 18, 5, board);
snake3 = new Snake(21, 9, 27, 5, 18, 5, board);
snake4 = new Snake(21, 15, 27, 5, 18, 5, board);
northZombie = new PyroZombie(15, 3, 25, 4, 3, 3, board);
northZombie.setGridPosition(15, 3);
northZombie.setCurrentPatrolPoint(new Vector2(27, 3));
northZombie.setNextPatrolPoint(new Vector2(5, 3));
southZombie = new PyroZombie(15, 20, 25, 4, 20, 20, board);
southZombie.setGridPosition(15, 20);
southZombie.setCurrentPatrolPoint(new Vector2(5, 20));
southZombie.setNextPatrolPoint(new Vector2(27, 20));
eastZombie = new PyroZombie(29, 11, 29, 29, 19, 4, board);
eastZombie.setGridPosition(29, 11);
eastZombie.setCurrentPatrolPoint(new Vector2(29, 17));
eastZombie.setNextPatrolPoint(new Vector2(29, 6));
westZombie = new PyroZombie(3, 11, 3, 3, 19, 4, board);
westZombie.setGridPosition(3, 11);
westZombie.setCurrentPatrolPoint(new Vector2(3, 5));
westZombie.setNextPatrolPoint(new Vector2(3, 18));
flames = new LinkedList<Flame>();
}