本文整理汇总了C#中Room.getBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Room.getBlock方法的具体用法?C# Room.getBlock怎么用?C# Room.getBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room.getBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: processPortals
void processPortals(Room room)
{
List<Point> targetPortalList = new List<Point>();
int loopIterator = 0;
Point currentLoopPortal = new Point(0, 0);
int _loc_4 = 0;
int _loc_5 = 0;
double _loc_6 = 0;
double _loc_7 = 0;
double _loc_8 = 0;
double _loc_9 = 0;
int _loc_10 = 0;
double _loc_11 = 0;
current = room.getBlock(0, cx, cy).blockId;
if (!isgodmod && current == 374/*itemId.WORLD_PORTAL*/)
{
if (spacejustdown && !worldportalsend)
{
//has hit world portal and leaves the world
/*
_loc_1 = Program.getWorldPortalTarget(cx, cy);
if (_loc_1.length > 0)
{
worldportalsend = true;
_loc_2 = new NavigationEvent(NavigationEvent.JOIN_WORLD, true, false);
_loc_2.world_id = _loc_1;
Global.base.dispatchEvent(_loc_2);
}*/
}
}
if (!isgodmod && current == 242)
{
if (lastPortal.X == 0 && lastPortal.Y == 0)
{
lastPortal = new Point(cx << 4, cy << 4);
//current = Form1.blockMap[cx, cy].Id;
Block currentBlock = room.getBlock(0, cx, cy);
int currentTarget = currentBlock.pt_target;
//Console.WriteLine("entered portal with id " + currentBlock.thisID + " and target id " + currentTarget + " and rotation " + currentBlock.rotation);
//targetPortalList = world.getPortals(world.getPortal(cx, cy).target);
for (int x = 1; x < room.Width; x++)
{
for (int y = 1; y < room.Height; y++)
{
Block block = room.getBlock(0, x, y);
if (block.isPortal() && block.blockId == currentTarget)
{
//Console.WriteLine("found portal target " + block.targetID);
targetPortalList.Add(new Point(x << 4, y << 4));
}
}
}
loopIterator = 0;
while (loopIterator < targetPortalList.Count)
{
//Console.WriteLine("iter: " + loopIterator);
currentLoopPortal = targetPortalList[loopIterator];
//_loc_4 = world.getPortal(lastPortal.x >> 4, lastPortal.y >> 4).rotation;
_loc_4 = room.getBlock(0, lastPortal.X >> 4, lastPortal.Y >> 4).pt_rotation;
//Console.WriteLine("1: " + _loc_4);
//_loc_5 = world.getPortal(currentLoopPortal.x >> 4, currentLoopPortal.y >> 4).rotation;
_loc_5 = room.getBlock(0, currentLoopPortal.X >> 4, currentLoopPortal.Y >> 4).pt_rotation;
//Console.WriteLine("2: " + _loc_5);
if (_loc_4 < _loc_5)
{
_loc_4 = _loc_4 + 4;
}
_loc_6 = speedX;
_loc_7 = speedY;
_loc_8 = modifierX;
_loc_9 = modifierY;
_loc_10 = _loc_4 - _loc_5;
_loc_11 = 1.42;
//Console.WriteLine("entering switch " + _loc_10);
switch (_loc_10)
{
case 1:
{
speedX = _loc_7 * _loc_11;
speedY = (-_loc_6) * _loc_11;
modifierX = _loc_9 * _loc_11;
modifierY = (-_loc_8) * _loc_11;
reminderY = -reminderY;
currentSY = -currentSY;
break;
}
case 3:
{
speedX = (-_loc_7) * _loc_11;
speedY = _loc_6 * _loc_11;
modifierX = (-_loc_9) * _loc_11;
modifierY = _loc_8 * _loc_11;
reminderX = -reminderX;
currentSX = -currentSX;
break;
}
case 2:
{
//.........这里部分代码省略.........
示例2: overlaps
public int overlaps(SynchronizedObject param1, Room room)
{
List<int> _loc_8 = new List<int>();
//int _loc_10 = 0;
int _loc_11 = 0;
if (param1.x < 16 || param1.y < 16 || param1.x >= room.Width * 16 || param1.y >= room.Height * 16)
{
//Console.WriteLine("returning 1, worldborder, " + name + " " + param1.x / 16 + " " + param1.y / 16);
return 1;
}
//else
//Console.WriteLine("NOT returning 1, worldborder, " + name + " " + param1.x / 16 + " " + param1.y / 16);
//PhysicPlayer _loc_2 = (PhysicPlayer)this;
if (this.isgod || this.ismod)
{
//Console.WriteLine("returning 0, isgod");
return 0;
}
double _loc_3 = ((this.x) / 16);
double _loc_4 = ((this.y) / 16);
//double _loc_5 = (param1.x + param1.height) / 16;
//Console.WriteLine(_loc_3 + " - " +_loc_5);
//double _loc_6 = (param1.y + param1.width) / 16;
//bool _loc_7 = false;
for (int xx = -2; xx < 1; xx++)
{
for (int yy = -2; yy < 1; yy++)
{
if (_loc_3 + xx > 0 && _loc_3 + xx < room.Width && _loc_4 + yy > 0 && _loc_4 + yy <= room.Height)
{
for (int xTest = 0; xTest < 16; xTest++)
{
for (int yTest = 0; yTest < 16; yTest++)
{
if (hitTest((int)(xTest + this.x + xx * 16), (int)(yTest + this.y + yy * 16)))
{
double _loc_9 = _loc_4;
_loc_11 = room.getBlock(0, (int)(((xx * 16) + this.x + xTest) / 16), (int)(((yy * 16) + this.y + yTest) / 16)).BlockId;
if (itemId.isSolid(_loc_11))
{
switch (_loc_11)
{
case 23:
{
/*if (this.hideRed)
{
break;
}*/
break;
}
case 24:
{
/*if (this.hideGreen)
{
break;
}*/
break;
}
case 25:
{
/*if (this.hideBlue)
{
break;
}*/
break;
}
case 26:
{
/*if (!this.hideRed)
{
break;
}*/
break;
}
case 27:
{
/*if (!this.hideGreen)
{
break;
}*/
break;
}
case 28:
{
/*if (!this.hideBlue)
{
break;
}*/
break;
}
case 156:
{
/*if (this._hideTimedoor)
{
break;
}*/
break;
}
//.........这里部分代码省略.........
示例3: tick
public override void tick(Room room)
{
this.animoffset = this.animoffset + 0.2;
if (this.ismod && !this.isgod)
{
this.modoffset = this.modoffset + 0.2;
if (this.modoffset >= 16)
{
this.modoffset = 10;
}
}
else if (this.isclubmember)
{
this.cluboffset = this.cluboffset + 0.2;
if (this.cluboffset >= 14)
{
this.cluboffset = 0;
}
}
else
{
this.modoffset = 0;
}
if (this.isDead)
{
this.deadoffset = this.deadoffset + 0.3;
}
else
{
this.deadoffset = 0;
}
cx = (int)((x + 8) / 16);
cy = (int)((y + 8) / 16);
int delayed = 0;
if (this.queue.Count >= 1)
{
delayed = this.queue.Dequeue();
}
this.current = room.getBlock(0, cx, cy).blockId;
this.queue.Enqueue(this.current);
if (this.current == 4 || itemId.isClimbable(this.current))
{
delayed = this.queue.Dequeue();
this.queue.Enqueue(this.current);
}
/*if (this.isme)
{
this.leftdown = Bl.isKeyDown(37) || Bl.isKeyDown(65) ? (-1) : (0);
this.rightdown = Bl.isKeyDown(39) || Bl.isKeyDown(68) ? (1) : (0);
this.updown = Bl.isKeyDown(38) || Bl.isKeyDown(87) ? (-1) : (0);
this.downdown = Bl.isKeyDown(40) || Bl.isKeyDown(83) ? (1) : (0);
this.spacejustdown = Bl.isKeyJustPressed(32);
this.spacedown = Bl.isKeyDown(32);
this.horizontal = this.leftdown + this.rightdown;
this.vertical = this.updown + this.downdown;
Bl.resetJustPressed();
}*/
if (this.isDead)
{
this.horizontal = 0;
this.vertical = 0;
this.spacejustdown = false;
this.spacedown = false;
}
isgodmod = this.isgod || this.ismod;
if (isgodmod)
{
this.morx = 0;
this.mory = 0;
this.mox = 0;
this.moy = 0;
}
else
{
switch (this.current)
{
case 1:
{
this.morx = -(int)_gravity;
this.mory = 0;
break;
}
case 2:
{
this.morx = 0;
this.mory = -(int)_gravity;
break;
}
case 3:
{
this.morx = (int)_gravity;
this.mory = 0;
break;
}
case 114://114/*itemId.SPEED_LEFT*/:
case 115://115/*itemId.SPEED_RIGHT*/:
case 116://116/*itemId.SPEED_UP*/:
case 117://117/*itemId.SPEED_DOWN */:
case 118://itemId.CHAIN:
case 120://itemId.NINJA_LADDER:
//.........这里部分代码省略.........