本文整理汇总了C#中Game.DeserializeFloat方法的典型用法代码示例。如果您正苦于以下问题:C# Game.DeserializeFloat方法的具体用法?C# Game.DeserializeFloat怎么用?C# Game.DeserializeFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game
的用法示例。
在下文中一共展示了Game.DeserializeFloat方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNewFrameFixed
public override void OnNewFrameFixed(Game game, NewFrameEventArgs args)
{
game.pushX = 0;
game.pushY = 0;
game.pushZ = 0;
float LocalPlayerPositionX = game.player.position.x;
float LocalPlayerPositionY = game.player.position.y;
float LocalPlayerPositionZ = game.player.position.z;
for (int i = 0; i < game.entitiesCount; i++)
{
Entity entity = game.entities[i];
if (entity == null) { continue; }
if (entity.push == null) { continue; }
//Prevent players that aren't displayed from pushing
if (entity.networkPosition != null && !entity.networkPosition.PositionLoaded) { continue; }
float kposX = game.DeserializeFloat(entity.push.XFloat);
float kposY = game.DeserializeFloat(entity.push.ZFloat);
float kposZ = game.DeserializeFloat(entity.push.YFloat);
if (entity.push.IsRelativeToPlayerPosition != 0)
{
kposX += LocalPlayerPositionX;
kposY += LocalPlayerPositionY;
kposZ += LocalPlayerPositionZ;
}
float dist = game.Dist(kposX, kposY, kposZ, LocalPlayerPositionX, LocalPlayerPositionY, LocalPlayerPositionZ);
if (dist < game.DeserializeFloat(entity.push.RangeFloat))
{
float diffX = LocalPlayerPositionX - kposX;
float diffY = LocalPlayerPositionY - kposY;
float diffZ = LocalPlayerPositionZ - kposZ;
game.pushX += diffX;
game.pushY += diffY;
game.pushZ += diffZ;
}
}
}
示例2: OnNewFrameFixed
public override void OnNewFrameFixed(Game game, NewFrameEventArgs args)
{
if (game.reloadstartMilliseconds != 0
&& (game.one * (game.platform.TimeMillisecondsFromStart() - game.reloadstartMilliseconds) / 1000)
> game.DeserializeFloat(game.blocktypes[game.reloadblock].ReloadDelayFloat))
{
{
int loaded = game.TotalAmmo[game.reloadblock];
loaded = MathCi.MinInt(game.blocktypes[game.reloadblock].AmmoMagazine, loaded);
game.LoadedAmmo[game.reloadblock] = loaded;
game.reloadstartMilliseconds = 0;
game.reloadblock = -1;
}
}
}
示例3: ToClientEntity
public static Entity ToClientEntity(Game game, Packet_ServerEntity entity, Entity old, bool updatePosition)
{
if (entity.Position != null)
{
if (old.position == null || updatePosition)
{
old.networkPosition = ToClientEntityPosition(entity.Position);
old.networkPosition.PositionLoaded = true;
old.networkPosition.LastUpdateMilliseconds = game.platform.TimeMillisecondsFromStart();
old.position = ToClientEntityPosition(entity.Position);
}
}
if (entity.DrawModel != null)
{
old.drawModel = new EntityDrawModel();
old.drawModel.eyeHeight = game.DeserializeFloat(entity.DrawModel.EyeHeight);
old.drawModel.ModelHeight = game.DeserializeFloat(entity.DrawModel.ModelHeight);
old.drawModel.Texture_ = entity.DrawModel.Texture_;
old.drawModel.Model_ = entity.DrawModel.Model_;
if (old.drawModel.Model_ == null)
{
old.drawModel.Model_ = "player.txt";
}
old.drawModel.DownloadSkin = entity.DrawModel.DownloadSkin != 0;
}
if (entity.DrawName_ != null)
{
old.drawName = new DrawName();
if (entity.DrawName_.Color != null)
{
old.drawName.Name = game.platform.StringFormat2("{0}{1}", entity.DrawName_.Color, entity.DrawName_.Name);
}
else
{
old.drawName.Name = entity.DrawName_.Name;
}
if (!game.platform.StringStartsWithIgnoreCase(old.drawName.Name, "&"))
{
old.drawName.Name = game.platform.StringFormat("&f{0}", old.drawName.Name);
}
old.drawName.OnlyWhenSelected = entity.DrawName_.OnlyWhenSelected;
old.drawName.ClientAutoComplete = entity.DrawName_.ClientAutoComplete;
}
if (entity.DrawText != null)
{
old.drawText = new EntityDrawText();
old.drawText.text = entity.DrawText.Text;
float one_ = 1;
old.drawText.dx = one_ * entity.DrawText.Dx / 32;
old.drawText.dy = one_ * entity.DrawText.Dy / 32;
old.drawText.dz = one_ * entity.DrawText.Dz / 32;
}
else
{
old.drawText = null;
}
if (entity.DrawBlock != null)
{
}
if (entity.Push != null)
{
old.push = new Packet_ServerExplosion();
old.push.RangeFloat = entity.Push.RangeFloat;
}
else
{
old.push = null;
}
old.usable = entity.Usable;
if (entity.DrawArea != null)
{
//New DrawArea
old.drawArea = new EntityDrawArea();
old.drawArea.x = entity.DrawArea.X;
old.drawArea.y = entity.DrawArea.Y;
old.drawArea.z = entity.DrawArea.Z;
old.drawArea.sizex = entity.DrawArea.Sizex;
old.drawArea.sizey = entity.DrawArea.Sizey;
old.drawArea.sizez = entity.DrawArea.Sizez;
}
else
{
//DrawArea deleted/not present
old.drawArea = null;
}
return old;
}
示例4: ConvertDialog
GameScreen ConvertDialog(Game game, Packet_Dialog p)
{
DialogScreen s = new DialogScreen();
s.widgets = new MenuWidget[p.WidgetsCount];
s.WidgetCount = p.WidgetsCount;
for (int i = 0; i < p.WidgetsCount; i++)
{
Packet_Widget a = p.Widgets[i];
MenuWidget b = new MenuWidget();
if (a.Type == Packet_WidgetTypeEnum.Text)
{
b.type = WidgetType.Label;
}
if (a.Type == Packet_WidgetTypeEnum.Image)
{
b.type = WidgetType.Button;
}
if (a.Type == Packet_WidgetTypeEnum.TextBox)
{
b.type = WidgetType.Textbox;
}
b.x = a.X;
b.y = a.Y;
b.sizex = a.Width;
b.sizey = a.Height_;
b.text = a.Text;
if (b.text != null)
{
b.text = game.platform.StringReplace(b.text, "!SERVER_IP!", game.ServerInfo.connectdata.Ip);
}
if (b.text != null)
{
b.text = game.platform.StringReplace(b.text, "!SERVER_PORT!", game.platform.IntToString(game.ServerInfo.connectdata.Port));
}
b.color = a.Color;
if (a.Font != null)
{
b.font = new FontCi();
b.font.family = game.ValidFont(a.Font.FamilyName);
b.font.size = game.DeserializeFloat(a.Font.SizeFloat);
b.font.style = a.Font.FontStyle;
}
b.id = a.Id;
b.isbutton = a.ClickKey != 0;
if (a.Image == "Solid")
{
b.image = null;
}
else if (a.Image != null)
{
b.image = StringTools.StringAppend(game.platform, a.Image, ".png");
}
s.widgets[i] = b;
}
for (int i = 0; i < s.WidgetCount; i++)
{
if (s.widgets[i] == null) { continue; }
if (s.widgets[i].type == WidgetType.Textbox)
{
s.widgets[i].editing = true;
break;
}
}
return s;
}
示例5: CurrentPickDistance
float CurrentPickDistance(Game game)
{
float pick_distance = game.PICK_DISTANCE;
IntRef inHand = game.BlockInHand();
if (inHand != null)
{
if (game.blocktypes[inHand.value].PickDistanceWhenUsedFloat > 0)
{
// This check ensures that players can select blocks when no value is given
pick_distance = game.DeserializeFloat(game.blocktypes[inHand.value].PickDistanceWhenUsedFloat);
}
}
if (game.cameratype == CameraType.Tpp)
{
pick_distance = game.tppcameradistance + game.PICK_DISTANCE;
}
if (game.cameratype == CameraType.Overhead)
{
if (game.platform.IsFastSystem())
{
pick_distance = 100;
}
else
{
pick_distance = game.overheadcameradistance * 2;
}
}
return pick_distance;
}
示例6: NextBullet
//.........这里部分代码省略.........
shot.IsHitHead = 1;
}
}
else
{
p = Intersection.CheckLineBoxExact(pick, bodybox);
if (p != null)
{
//do not allow to shoot through terrain
if (pick2count.value == 0 || (game.Dist(pick2[0].blockPos[0], pick2[0].blockPos[1], pick2[0].blockPos[2], localeyeposX, localeyeposY, localeyeposZ)
> game.Dist(p[0], p[1], p[2], localeyeposX, localeyeposY, localeyeposZ)))
{
if (!isgrenade)
{
Entity entity = new Entity();
Sprite sprite = new Sprite();
sprite.positionX = p[0];
sprite.positionY = p[1];
sprite.positionZ = p[2];
sprite.image = "blood.png";
entity.sprite = sprite;
entity.expires = Expires.Create(one * 2 / 10);
game.EntityAddLocal(entity);
}
shot.HitPlayer = i;
shot.IsHitHead = 0;
}
}
}
}
shot.WeaponBlock = item.BlockId;
game.LoadedAmmo[item.BlockId] = game.LoadedAmmo[item.BlockId] - 1;
game.TotalAmmo[item.BlockId] = game.TotalAmmo[item.BlockId] - 1;
float projectilespeed = game.DeserializeFloat(game.blocktypes[item.BlockId].ProjectileSpeedFloat);
if (projectilespeed == 0)
{
{
Entity entity = game.CreateBulletEntity(
pick.Start[0], pick.Start[1], pick.Start[2],
toX, toY, toZ, 150);
game.EntityAddLocal(entity);
}
}
else
{
float vX = toX - pick.Start[0];
float vY = toY - pick.Start[1];
float vZ = toZ - pick.Start[2];
float vLength = game.Length(vX, vY, vZ);
vX /= vLength;
vY /= vLength;
vZ /= vLength;
vX *= projectilespeed;
vY *= projectilespeed;
vZ *= projectilespeed;
shot.ExplodesAfter = game.SerializeFloat(game.grenadetime - wait);
{
Entity grenadeEntity = new Entity();
Sprite sprite = new Sprite();
sprite.image = "ChemicalGreen.png";
sprite.size = 14;
sprite.animationcount = 0;
sprite.positionX = pick.Start[0];
sprite.positionY = pick.Start[1];
示例7: BuildDelay
internal float BuildDelay(Game game)
{
float default_ = (1f * 95 / 100) * (1 / game.basemovespeed);
Packet_Item item = game.d_Inventory.RightHand[game.ActiveMaterial];
if (item == null || item.ItemClass != Packet_ItemClassEnum.Block)
{
return default_;
}
float delay = game.DeserializeFloat(game.blocktypes[item.BlockId].DelayFloat);
if (delay == 0)
{
return default_;
}
return delay;
}