本文整理汇总了C#中PlayerProfile.AddSensor方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerProfile.AddSensor方法的具体用法?C# PlayerProfile.AddSensor怎么用?C# PlayerProfile.AddSensor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerProfile
的用法示例。
在下文中一共展示了PlayerProfile.AddSensor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reload
public override void Reload()
{
var winSize = DefaultSettings.Settings["WindowSize"];
PhysicsManager = new PhysicsEngine(new Region(0, (float)winSize.Width, 0, (float)winSize.Height), 10);
PhysicsManager.AddUniversalForce(DefaultForces.LinearDrag);
var world = new List<WorldObject>();
ActiveMap = new Map(world);
/*
* Setup Map
*/
int goodRoidNumber = 10;
int badRoidNumber = 5;
int bombRoidNumber = 5;
int chargesAllowed = 5;
int sensorsAllowed = 5;
PlayerProfile = new PlayerProfile(1000, // Health
badRoidNumber, goodRoidNumber); // Roids
Random rand = new Random();
var player = new Player(
new Vector2((float)rand.NextDouble() * (winSize.Width - 50), (float)rand.NextDouble() * (winSize.Height - 50)),
0f);
player.GotHurt += new PlayerEventHandler(player_GotHurt);
SpawnObject<Actor>(player);
for (int i = 0; i < chargesAllowed; i++)
PlayerProfile.AddCharge(new Charge(50, 15));
for (int i = 0; i < sensorsAllowed; i++)
PlayerProfile.AddSensor(new Sensor(60f));
for (int i = 0; i < goodRoidNumber; i++)
{
var pos = new Vector2((float)MathUtils.Rand.Next(50, (int)winSize.Width - 50), (float)MathUtils.Rand.Next(50, (int)winSize.Height - 50));
var rad = 15f + (float)MathUtils.Rand.NextDouble() * Asteroid.MaxRadius;
var gr = new GoodRoid(pos, rad, 1000f, .1f, new Vector2((float)MathUtils.Rand.NextDouble() * 300, (float)MathUtils.Rand.NextDouble() * 300));
gr.Destroyed += new WorldObjectEventHandler(goodRoid_Destroyed);
SpawnObject<Actor>(gr);
}
for (int i = 0; i < badRoidNumber; i++)
{
var pos = new Vector2((float)MathUtils.Rand.Next(50, (int)winSize.Width - 50), (float)MathUtils.Rand.Next(50, (int)winSize.Height - 50));
var rad = 15f + (float)MathUtils.Rand.NextDouble() * Asteroid.MaxRadius;
var br = new BadRoid(pos, rad, 1000f, .1f, new Vector2((float)MathUtils.Rand.NextDouble()*300,(float)MathUtils.Rand.NextDouble()*300));
br.Destroyed += new WorldObjectEventHandler(badRoid_Destroyed);
SpawnObject<Actor>(br);
}
for (int i = 0; i < bombRoidNumber; i++)
{
var pos = new Vector2((float)MathUtils.Rand.Next(50, (int)winSize.Width - 50), (float)MathUtils.Rand.Next(50, (int)winSize.Height - 50));
var rad = 15f + (float)MathUtils.Rand.NextDouble() * Asteroid.MaxRadius;
var br = new BombRoid(pos, rad);
SpawnObject<Actor>(br);
}
//
//
//
// Walls -- invisible
var w0 = new ROIDS.Sandbox.VertWallBody(new Vector2(0, winSize.Height / 2), winSize.Height);
var w1 = new ROIDS.Sandbox.VertWallBody(new Vector2(winSize.Width, winSize.Height / 2), winSize.Height);
var w2 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, 0), winSize.Width);
var w3 = new ROIDS.Sandbox.HorizWallBody(new Vector2(winSize.Width / 2, winSize.Height), winSize.Width);
PhysicsManager.MapBodies.Add(w0);
PhysicsManager.MapBodies.Add(w1);
PhysicsManager.MapBodies.Add(w2);
PhysicsManager.MapBodies.Add(w3);
this.Write("Health: {0}\nCharges: {1}\nSensors: {2}\nRoids to Blast: {3}",
PlayerProfile.Health,
PlayerProfile.ChargesLeft,
PlayerProfile.SensorsLeft,
PlayerProfile.RoidsToBlast);
}