本文整理汇总了C#中IMap.SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IMap.SetAttribute方法的具体用法?C# IMap.SetAttribute怎么用?C# IMap.SetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMap
的用法示例。
在下文中一共展示了IMap.SetAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTraps
public static void AddTraps(Client client, IMap imap)
{
int[] traps = new int[] {2, 3, 4, 5, 6, 7, 23, 25, 26, 28, 42, 43, 44, 50, 51, 52, 53};
int randx, randy;
int rand = Server.Math.Rand(0, 20);
if (rand >= 17) { //17, 18, 19; 2 traps
for (int i = 0; i < 2; i++) {
randx = Server.Math.Rand(0, imap.MaxX+1);
randy = Server.Math.Rand(0, imap.MaxY+1);
rand = traps[Server.Math.Rand(0, traps.Length)];
if (imap.Tile[randx,randy].Type == Server.Enums.TileType.Walkable) imap.SetAttribute(randx, randy, Enums.TileType.Scripted, rand, 0, 0, "", "", "");
else i--;
}
} else if (rand >= 10) { //1 trap; 1/2 chance of no trap
for (int i = 0; i < 1; i++) {
randx = Server.Math.Rand(0, imap.MaxX+1);
randy = Server.Math.Rand(0, imap.MaxY+1);
rand = traps[Server.Math.Rand(0, traps.Length)];
if (imap.Tile[randx,randy].Type == Server.Enums.TileType.Walkable) imap.SetAttribute(randx, randy, Enums.TileType.Scripted, rand, 0, 0, "", "", "");
else i--;
}
}
}
示例2: DecorateMap
public static void DecorateMap(Client client, IMap imap)
{
int rand, rand2;
int x = exPlayer.Get(client).DungeonX;
int y = exPlayer.Get(client).DungeonY;
int id = exPlayer.Get(client).DungeonID;
int randx, randy;
if (Server.Math.Rand(0,20) == 0) { //lock
if (imap.MaxX == 19) {
for (int i = 8; i <= 11; i++) {
if (imap.Tile[i,1].Type == Enums.TileType.Walkable) {
imap.SetTile(i, 1, 6, 4, 1);
imap.SetAttribute(i, 1, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
if (imap.Tile[i,13].Type == Enums.TileType.Walkable) {
imap.SetTile(i, 13, 6, 4, 1);
imap.SetAttribute(i, 13, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
}
for (int i = 6; i <= 8; i++) {
if (imap.Tile[1,i].Type == Enums.TileType.Walkable) {
imap.SetTile(1,i, 6, 4, 1);
imap.SetAttribute(1,i, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
if (imap.Tile[18,i].Type == Enums.TileType.Walkable) {
imap.SetTile(18,i, 6, 4, 1);
imap.SetAttribute(18,i, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
}
} else if (imap.MaxX == 46) {
for (int i = 22; i <= 24; i++) {
if (imap.Tile[i,1].Type == Enums.TileType.Walkable) {
imap.SetTile(i, 1, 6, 4, 1);
imap.SetAttribute(i, 1, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
if (imap.Tile[i,33].Type == Enums.TileType.Walkable) {
imap.SetTile(i, 33, 6, 4, 1);
imap.SetAttribute(i, 33, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
}
for (int i = 16; i <= 18; i++) {
if (imap.Tile[1,i].Type == Enums.TileType.Walkable) {
imap.SetTile(1,i, 6, 4, 1);
imap.SetAttribute(1,i, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
if (imap.Tile[45,i].Type == Enums.TileType.Walkable) {
imap.SetTile(45,i, 6, 4, 1);
imap.SetAttribute(45,i, Enums.TileType.Key, 559, 1, 0, "", "", "");
}
}
}
}
imap.OriginalDarkness = Server.Math.Rand(0,19);
if (imap.MaxX > 20) imap.OriginalDarkness += 6;
imap.Indoors = true;
imap.Music = "PMD2) Dark Crater.ogg";
//ground decorations
if ((x != 1 && y != 1) && (x != 10) && (y != 10)){
rand = Server.Math.Rand(28, 42);
for (int i = 1; i <= rand; i++) {
randx = Server.Math.Rand(0, imap.MaxX+1);
randy = Server.Math.Rand(0, imap.MaxY+1);
rand2 = Server.Math.Rand(0, 2);
if (rand2==0) rand2 = 404;
else rand2 = 417;
imap.SetTile(randx, randy, rand2, 9, 0);
}
}
//wall decorations
rand = Server.Math.Rand(0, 20);
for (int i = 1; i <= rand; i++) {
randx = Server.Math.Rand(0, imap.MaxX+1);
randy = Server.Math.Rand(0, imap.MaxY+1);
rand2 = Server.Math.Rand(0, 2);
if (rand2==0) rand2 = 471;
else rand2 = 484;
if (imap.Tile[randx,randy].Type == Server.Enums.TileType.NPCAvoid) imap.SetTile(randx, randy, rand2, 9, 1);
else i--;
}
AddTraps(client, imap);
}
示例3: UnlockRoom
public static void UnlockRoom(Client client, IMap imap)
{
int remainingEnemies = 0;
for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) {
if (!imap.IsNpcSlotEmpty(i)) remainingEnemies++;
}
if (remainingEnemies <= 1) {
if (imap.MaxX == 19) {
for (int i = 8; i <= 11; i++) {
if (imap.Tile[i,1].Type == Enums.TileType.Key) {
imap.SetTile(i, 1, 0, 0, 1);
imap.SetAttribute(i, 1, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(i, 1, imap);
}
if (imap.Tile[i,13].Type == Enums.TileType.Key) {
imap.SetTile(i, 13, 0, 0, 1);
imap.SetAttribute(i, 13, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(i, 13, imap);
}
}
for (int i = 6; i <= 8; i++) {
if (imap.Tile[1,i].Type == Enums.TileType.Key) {
imap.SetTile(1, i, 0, 0, 1);
imap.SetAttribute(1, i, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(1, i, imap);
}
if (imap.Tile[18,i].Type == Enums.TileType.Key) {
imap.SetTile(18,i, 0, 0, 1);
imap.SetAttribute(18, i, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(18, i, imap);
}
}
} else if (imap.MaxX == 46) {
for (int i = 22; i <= 24; i++) {
if (imap.Tile[i,1].Type == Enums.TileType.Key) {
imap.SetTile(i, 1, 0, 0, 1);
imap.SetAttribute(i, 1, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(i, 1, imap);
}
if (imap.Tile[i,33].Type == Enums.TileType.Key) {
imap.SetTile(i, 33, 0, 0, 1);
imap.SetAttribute(i, 33, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(i, 33, imap);
}
}
for (int i = 16; i <= 18; i++) {
if (imap.Tile[1,i].Type == Enums.TileType.Key) {
imap.SetTile(1, i, 0, 0, 1);
imap.SetAttribute(1, i, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(1, i, imap);
}
if (imap.Tile[45,i].Type == Enums.TileType.Key) {
imap.SetTile(45, i, 0, 0, 1);
imap.SetAttribute(45, i, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
Messenger.SendTile(45, i, imap);
}
}
}
}
}