本文整理汇总了C#中fCraft.Position类的典型用法代码示例。如果您正苦于以下问题:C# Position类的具体用法?C# Position怎么用?C# Position使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Position类属于fCraft命名空间,在下文中一共展示了Position类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Player
// Normal constructor
internal Player( World _world, string _name, Session _session, Position _pos ) {
world = _world;
name = _name;
nick = name;
session = _session;
pos = _pos;
info = world.db.FindPlayerInfo( this );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:Player.cs
示例2: MakeMove
internal static Packet MakeMove( int id, Position pos )
{
Packet packet = new Packet( OpCode.Move );
packet.Data[1] = ( byte )id;
packet.Data[2] = ( byte )pos.X;
packet.Data[3] = ( byte )pos.Z;
packet.Data[4] = ( byte )pos.Y;
return packet;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:9,代码来源:Packets.cs
示例3: WriteTeleport
public void WriteTeleport( byte id, Position pos ) {
Write( OpCode.Teleport );
Write( id );
Write( pos.X );
Write( pos.Z );
Write( pos.Y );
Write( pos.R );
Write( pos.L );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:PacketWriter.cs
示例4: WriteAddEntity
public void WriteAddEntity( byte id, string name, Position pos ) {
Write( OutputCodes.AddEntity );
Write( id );
Write( name );
Write( (short)pos.x );
Write( (short)pos.h );
Write( (short)pos.y );
Write( pos.r );
Write( pos.l );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:PacketWriter.cs
示例5: Player
// Normal constructor
internal Player( World world, string name, Session session, Position position ) {
if( name == null ) throw new ArgumentNullException( "name" );
if( session == null ) throw new ArgumentNullException( "session" );
World = world;
Session = session;
Position = position;
Info = PlayerDB.FindOrCreateInfoForPlayer( name, session.IP );
spamBlockLog = new Queue<DateTime>( Info.Rank.AntiGriefBlocks );
ResetAllBinds();
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:Player.cs
示例6: Bot
public Bot(string name, Position Pos)
{
this.name = name;
this.playerID = 1;
pos = Pos;
heading = 0;
pitch = 0;
time = 0;
update = true;
}
开发者ID:GMathioud,项目名称:MyCraft,代码行数:10,代码来源:PathFinding.cs
示例7: MakeTeleport
public static Packet MakeTeleport( sbyte id, Position pos ) {
Packet packet = new Packet( OpCode.Teleport );
packet.Bytes[1] = (byte)id;
ToNetOrder( pos.X, packet.Bytes, 2 );
ToNetOrder( pos.Z, packet.Bytes, 4 );
ToNetOrder( pos.Y, packet.Bytes, 6 );
packet.Bytes[8] = pos.R;
packet.Bytes[9] = pos.L;
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:Packet.cs
示例8: MakeMoveRotate
internal static Packet MakeMoveRotate( int id, Position pos )
{
Packet packet = new Packet( OpCode.MoveRotate );
packet.Data[1] = ( byte )id;
packet.Data[2] = ( byte )( pos.X & 0xFF );
packet.Data[3] = ( byte )( pos.Z & 0xFF );
packet.Data[4] = ( byte )( pos.Y & 0xFF );
packet.Data[5] = pos.R;
packet.Data[6] = pos.L;
return packet;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:11,代码来源:Packets.cs
示例9: WriteAddEntity
public void WriteAddEntity( byte id, Player player, Position pos )
{
Write( OutputCodes.AddEntity );
Write( id );
Write( player.GetListName() );
Write( (short)pos.x );
Write( (short)pos.h );
Write( (short)pos.y );
Write( pos.r );
Write( pos.l );
}
开发者ID:asiekierka,项目名称:afCraft,代码行数:11,代码来源:PacketWriter.cs
示例10: setBot
/// <summary>
/// Sets a bot, as well as the bot values. Must be called before any other bot classes.
/// </summary>
public void setBot(String botName, String skinName, String modelName, World botWorld, Position pos, sbyte entityID) {
Name = botName;
SkinName = (skinName ?? SkinName);
Model = (modelName ?? Model);
World = botWorld;
Position = pos;
ID = entityID;
World.Bots.Add(this);
Server.SaveEntity(this);
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:14,代码来源:Bot.cs
示例11: Bot
private bool _isMoving; //if the bot can move, can be changed if it is not boxed in ect
#endregion Fields
#region Constructors
public Bot(string name, Position pos, int iD, World world_)
{
Name = name; //bots should be gray :P
Pos = pos;
ID = iD;
world = world_;
_isMoving = false;
_direction = Direction.South; //start off at south
StartNewAIMovement(); //start the while loop in a new thread. I want to change the way the thread works
//its only like this for testing purposes
}
开发者ID:tboxx,项目名称:800craft-1,代码行数:17,代码来源:Bot.cs
示例12: WriteAddEntity
public void WriteAddEntity( byte id, [NotNull] Player player, Position pos ) {
if( player == null ) throw new ArgumentNullException( "player" );
Write( OpCode.AddEntity );
Write( id );
Write( player.ListName );
Write( pos.X );
Write( pos.Z );
Write( pos.Y );
Write( pos.R );
Write( pos.L );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:11,代码来源:PacketWriter.cs
示例13: MakeAddEntity
public static Packet MakeAddEntity( sbyte id, [NotNull] string name, Position pos ) {
if( name == null ) throw new ArgumentNullException( "name" );
Packet packet = new Packet( OpCode.AddEntity );
packet.Bytes[1] = (byte)id;
Encoding.ASCII.GetBytes( name.PadRight( 64 ), 0, 64, packet.Bytes, 2 );
ToNetOrder( pos.X, packet.Bytes, 66 );
ToNetOrder( pos.Z, packet.Bytes, 68 );
ToNetOrder( pos.Y, packet.Bytes, 70 );
packet.Bytes[72] = pos.R;
packet.Bytes[73] = pos.L;
return packet;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:13,代码来源:Packet.cs
示例14: MakeAddEntity
/// <summary> Creates a new AddEntity (0x07) packet. </summary>
/// <param name="id"> Entity ID. Negative values refer to "self". </param>
/// <param name="name"> Entity name. May not be null. </param>
/// <param name="spawnPosition"> Spawning position for the player. </param>
/// <exception cref="ArgumentNullException"> name is null </exception>
public static Packet MakeAddEntity( sbyte id, [NotNull] string name, Position spawnPosition ) {
if (name == null) throw new ArgumentNullException("name");
Packet packet = new Packet( OpCode.AddEntity );
//Logger.Log(LogType.Debug, "Send: MakeAddEntity({0}, {1}, {2})", id, name, spawnPosition);
packet.Bytes[1] = (byte)id;
Encoding.ASCII.GetBytes( name.PadRight( 64 ), 0, 64, packet.Bytes, 2 );
ToNetOrder( spawnPosition.X, packet.Bytes, 66 );
ToNetOrder( spawnPosition.Z, packet.Bytes, 68 );
ToNetOrder( spawnPosition.Y, packet.Bytes, 70 );
packet.Bytes[72] = spawnPosition.R;
packet.Bytes[73] = spawnPosition.L;
return packet;
}
开发者ID:Magi1053,项目名称:ProCraft,代码行数:19,代码来源:Packet.cs
示例15: MakeZone
static void MakeZone( Player player, Position[] marks, object tag ) {
Zone zone = (Zone)tag;
zone.xMin = Math.Min( marks[0].x, marks[1].x );
zone.xMax = Math.Max( marks[0].x, marks[1].x );
zone.yMin = Math.Min( marks[0].y, marks[1].y );
zone.yMax = Math.Max( marks[0].y, marks[1].y );
zone.hMin = Math.Min( marks[0].h, marks[1].h );
zone.hMax = Math.Max( marks[0].h, marks[1].h );
player.Message( "Zone \"" + zone.name + "\" created, " + zone.getVolume() + " blocks total." );
player.world.log.Log( "Player {0} created a new zone \"{1}\" containing {2} blocks.", LogType.UserActivity,
player.name,
zone.name,
zone.getVolume() );
player.world.map.zones.Add( zone );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:15,代码来源:MapCommands.cs
示例16: ResetSpawn
/// <summary> Resets spawn to the default location.
/// Sets the spawn point 1 block above the surface of the map (above the first non-air block), right in the center. </summary>
public void ResetSpawn() {
if (Blocks == null) {
// fallback for maps that don't have a block array yet
Spawn = new Position(Width*16,
Length*16,
Math.Min(Height*32, Int16.MaxValue));
return;
}
int spawnZ = 0;
for (int z = Height - 1; z > 0; z--) {
if (GetBlock(Width/2, Length/2, z) != Block.Air) {
spawnZ = z + 1;
break;
}
}
Spawn = new Position(Width*16,
Length*16,
spawnZ);
}
开发者ID:fragmer,项目名称:fCraft,代码行数:21,代码来源:Map.cs
示例17: IsInRangeOfSpawnpoint
public static bool IsInRangeOfSpawnpoint( World world, Position PlayerPos )
{
try {
int Xdistance = ( world.Map.Spawn.X / 32 ) - ( PlayerPos.X / 32 );
int Ydistance = ( world.Map.Spawn.Y / 32 ) - ( PlayerPos.Y / 32 );
int Zdistance = ( world.Map.Spawn.Z / 32 ) - ( PlayerPos.Z / 32 );
if ( Xdistance <= 20 && Xdistance >= -20 ) {
if ( Ydistance <= 20 && Ydistance >= -20 ) {
if ( Zdistance <= 20 && Zdistance >= -20 ) {
return true;
}
}
}
} catch ( Exception ex ) {
Logger.Log( LogType.Error, "GuildHandler.IsInRangeOfSpawnpoint: " + ex );
}
return false;
}
开发者ID:Jonty800,项目名称:Guilds,代码行数:20,代码来源:Events.cs
示例18: JoinWorld
public void JoinWorld( [NotNull] World newWorld, WorldChangeReason reason ) {
if( newWorld == null ) throw new ArgumentNullException( "newWorld" );
lock( joinWorldLock ) {
useWorldSpawn = true;
postJoinPosition = Position.Zero;
forcedWorldToJoin = newWorld;
worldChangeReason = reason;
}
}
开发者ID:fragmer,项目名称:fCraft,代码行数:9,代码来源:Player.Networking.cs
示例19: ProcessMovementPacket
void ProcessMovementPacket() {
BytesReceived += 10;
reader.ReadByte();
Position newPos = new Position {
X = IPAddress.NetworkToHostOrder( reader.ReadInt16() ),
Z = IPAddress.NetworkToHostOrder( reader.ReadInt16() ),
Y = IPAddress.NetworkToHostOrder( reader.ReadInt16() ),
R = reader.ReadByte(),
L = reader.ReadByte()
};
Position oldPos = Position;
// calculate difference between old and new positions
Position delta = new Position {
X = (short)(newPos.X - oldPos.X),
Y = (short)(newPos.Y - oldPos.Y),
Z = (short)(newPos.Z - oldPos.Z),
R = (byte)Math.Abs( newPos.R - oldPos.R ),
L = (byte)Math.Abs( newPos.L - oldPos.L )
};
// skip everything if player hasn't moved
if( delta.IsZero ) return;
bool rotChanged = (delta.R != 0) || (delta.L != 0);
// only reset the timer if player rotated
// if player is just pushed around, rotation does not change (and timer should not reset)
if( rotChanged ) ResetIdleTimer();
if( Info.IsFrozen ) {
// special handling for frozen players
if( delta.X * delta.X + delta.Y * delta.Y > AntiSpeedMaxDistanceSquared ||
Math.Abs( delta.Z ) > 40 ) {
SendNow( PacketWriter.MakeSelfTeleport( Position ) );
}
newPos.X = Position.X;
newPos.Y = Position.Y;
newPos.Z = Position.Z;
// recalculate deltas
delta.X = 0;
delta.Y = 0;
delta.Z = 0;
} else if( !Can( Permission.UseSpeedHack ) ) {
int distSquared = delta.X * delta.X + delta.Y * delta.Y + delta.Z * delta.Z;
// speedhack detection
if( DetectMovementPacketSpam() ) {
return;
} else if( (distSquared - delta.Z * delta.Z > AntiSpeedMaxDistanceSquared || delta.Z > AntiSpeedMaxJumpDelta) &&
speedHackDetectionCounter >= 0 ) {
if( speedHackDetectionCounter == 0 ) {
lastValidPosition = Position;
} else if( speedHackDetectionCounter > 1 ) {
DenyMovement();
speedHackDetectionCounter = 0;
return;
}
speedHackDetectionCounter++;
} else {
speedHackDetectionCounter = 0;
}
}
if( RaisePlayerMovingEvent( this, newPos ) ) {
DenyMovement();
return;
}
Position = newPos;
RaisePlayerMovedEvent( this, oldPos );
}
开发者ID:fragmer,项目名称:fCraft,代码行数:77,代码来源:Player.Networking.cs
示例20: VisibleEntity
public VisibleEntity( Position newPos, sbyte newId, Rank newRank ) {
Id = newId;
LastKnownPosition = newPos;
MarkedForRetention = true;
Hidden = true;
LastKnownRank = newRank;
}
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:Player.Networking.cs
注:本文中的fCraft.Position类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论