本文整理汇总了C#中ScriptCoreLib.Random方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.Random方法的具体用法?C# ScriptCoreLib.Random怎么用?C# ScriptCoreLib.Random使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib
的用法示例。
在下文中一共展示了ScriptCoreLib.Random方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FlashTowerDefenseSized
//.........这里部分代码省略.........
};
};
#endregion
#region ScoreBoard
var ScoreBoard = new TextField
{
x = 24,
y = 24,
defaultTextFormat = new TextFormat
{
size = 12
},
autoSize = TextFieldAutoSize.LEFT,
text = "Defend yourself by shooting those mad sheep.",
filters = new[] { new BlurFilter() },
selectable = false,
};
//ScoreBoard.AttachTo(this);
BlurWarzoneOnHover(ScoreBoard, true);
#endregion
Action<double, Action> Times =
(m, h) => (DefaultWidth * DefaultHeight * m).Times(h);
Action<double, Func<BitmapAsset>> AddDoodads =
(m, GetImage) => Times(m, () => GetImage().AttachTo(bg).SetCenteredPosition(DefaultWidth.Random(), DefaultHeight.Random()));
AddDoodads(0.0001, () => Images.grass1.ToBitmapAsset());
AddDoodads(0.00005, () => Images.bump2.ToBitmapAsset());
Action StartIngameMusic =
delegate
{
if (this.IngameMusic != null)
this.IngameMusic.stop();
this.IngameMusic = Sounds.snd_world.ToSoundAsset().play(0, 999, new SoundTransform(IngameMusicVolume));
};
StartIngameMusic();
Func<Animation> AddCactus = () =>
new Animation(null, Images.img_cactus)
{
FrameRate = 1000 / 7,
AnimationEnabled = true
};
Action<double> AddCactusAt = y =>
{
var x = DefaultWidth.Random();
AddCactus().AttachTo(GetWarzone()).MoveTo(
x, y + Math.Cos(x + y) * DefaultHeight * 0.03);
};