本文整理汇总了C#中MiNET.Worlds.Level.AddPlayer方法的典型用法代码示例。如果您正苦于以下问题:C# Level.AddPlayer方法的具体用法?C# Level.AddPlayer怎么用?C# Level.AddPlayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MiNET.Worlds.Level
的用法示例。
在下文中一共展示了Level.AddPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnLevel
public virtual void SpawnLevel(Level toLevel, PlayerLocation spawnPoint)
{
bool oldNoAi = NoAi;
SetNoAi(true);
// send teleport straight up, no chunk loading
SetPosition(new PlayerLocation
{
X = KnownPosition.X, Y = 4000, Z = KnownPosition.Z, Yaw = 91, Pitch = 28, HeadYaw = 91,
});
//if (Level != null)
{
Level.RemovePlayer(this, true);
Level.EntityManager.RemoveEntity(null, this);
}
Level = toLevel; // Change level
SpawnPosition = spawnPoint;
//Level.AddPlayer(this, "", false);
// reset all health states
HealthManager.ResetHealth();
SendSetHealth();
SendSetSpawnPosition();
SendAdventureSettings();
SendPlayerInventory();
CleanCache();
ForcedSendChunk(spawnPoint);
// send teleport to spawn
SetPosition(spawnPoint);
SetNoAi(oldNoAi);
Level.AddPlayer(this, true);
Log.InfoFormat("Respawn player {0} on level {1}", Username, Level.LevelId);
SendSetTime();
ThreadPool.QueueUserWorkItem(delegate(object state) { ForcedSendChunks(); });
}
示例2: SpawnLevel
public virtual void SpawnLevel(Level toLevel, PlayerLocation spawnPoint)
{
SetNoAi(true);
// send teleport straight up, no chunk loading
SetPosition(new PlayerLocation
{
X = KnownPosition.X,
Y = 4000,
Z = KnownPosition.Z,
Yaw = 91,
Pitch = 28,
HeadYaw = 91,
});
Level.RemovePlayer(this, true);
Level.EntityManager.RemoveEntity(null, this);
Level = toLevel; // Change level
SpawnPosition = spawnPoint;
Level.AddPlayer(this, "", false);
// reset all health states
HealthManager.ResetHealth();
SendSetHealth();
SendSetSpawnPosition();
SendAdventureSettings();
SendPlayerInventory();
lock (_chunksUsed)
{
_chunksUsed.Clear();
}
ForcedSendChunksForKnownPosition(spawnPoint);
// send teleport to spawn
SetPosition(spawnPoint);
SetNoAi(false);
Level.SpawnToAll(this);
IsSpawned = true;
Log.InfoFormat("Respawn player {0} on level {1}", Username, Level.LevelId);
SendSetTime();
}