本文整理汇总了C#中System.Net.Player.setPlayerTexture方法的典型用法代码示例。如果您正苦于以下问题:C# Player.setPlayerTexture方法的具体用法?C# Player.setPlayerTexture怎么用?C# Player.setPlayerTexture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.Player
的用法示例。
在下文中一共展示了Player.setPlayerTexture方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecvrMsgCallback
private void RecvrMsgCallback()
{
while (running)
{
try
{
System.Diagnostics.Debug.WriteLine("Hello");
byte[] bytes = new byte[1024];
int bytesRec;
bytesRec = handler.Receive(bytes);
time = 0;
// Message
Console.WriteLine(bytesRec);
Console.WriteLine("Message Received: {0}", Encoding.ASCII.GetString(bytes, 0, bytesRec));
System.Diagnostics.Debug.WriteLine("Message Received: " + Encoding.ASCII.GetString(bytes, 0, bytesRec));
//Game1.GameObject.text = "Message Received: " + Encoding.ASCII.GetString(bytes, 0, bytesRec);
//string response = "OK";
// Message Handling Here
//Message[] mArray = Message.ParseStream(bytes);
//for (int i = 0; i < mArray.Count(); i++)
//{
Message m = new Message();//mArray[i];
m.Parse(bytes);
System.Diagnostics.Debug.WriteLine(m.msgCode + "," + m.ToString());
Game1.GameObject.text = "From PeerID : " + PeerID + " : " + m.GetString();
if (m.msgCode == Message.FIRE)
{
//nembak
Console.WriteLine("TEMBAK");
lock (Game1.GameObject.Bullets)
{
Game1.GameObject.Bullets.Add(new Bullet(Game1.GameObject, m.playerPos, m.bulletV0, m.playerRot, new Microsoft.Xna.Framework.Vector2(0, 10)));
}
}
else if (m.msgCode == Message.KEEP_ALIVE)
{
//keep alive
Player player = Game1.GameObject.Players[m.PeerID];
if (player != null)
{
player.setHealthPoint(m.HP);
}
}
else if (m.msgCode == Message.NEXT_PLAYER)
{
Game1.GameObject.WhoseTurn = m.nextPlayer;
//next player
if (Connection.peerID.Equals(m.nextPlayer))
{
// Set Fire true
Game1.GameObject.myPlayer.setFire(false);
}
}
else if (m.msgCode == Message.POS)
{
//kirim position
Player player = Game1.GameObject.Players[m.PeerID];
if (player != null)
{
player.setPosition(m.playerPos);
player.setAngle(m.playerRot);
player.setOrientation(m.playerOrt);
}
}
else if (m.msgCode == Message.INIT)
{
//init
Player player = new Player(m.PeerID, m.playerPos0);
switch (m.playerTexture)
{
case 0:
player.setPlayerTexture(AssetsManager.AssetsList["orang1"]);
break;
case 1:
player.setPlayerTexture(AssetsManager.AssetsList["orang2"]);
break;
case 2:
player.setPlayerTexture(AssetsManager.AssetsList["orang3"]);
break;
case 3:
player.setPlayerTexture(AssetsManager.AssetsList["orang4"]);
break;
default:
player.setPlayerTexture(AssetsManager.AssetsList["orang1"]);
break;
}
lock (Game1.GameObject.Players)
{
Game1.GameObject.Players.Add(m.PeerID, player);
}
}
//Response
//SendMsg(response);
//.........这里部分代码省略.........