本文整理汇总了C#中Game1.AddScore方法的典型用法代码示例。如果您正苦于以下问题:C# Game1.AddScore方法的具体用法?C# Game1.AddScore怎么用?C# Game1.AddScore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Game1
的用法示例。
在下文中一共展示了Game1.AddScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update(Game1 game)
{
int input = GetInput();
if (OneDirectionTimer > 0) {
if (OneDirectionMask == 0)
OneDirectionMask = input;
input &= OneDirectionMask;
}
if (ConfuseTimer > 0)
input = ((input & 1) << 1) | ((input & 2) >> 1);
UpdatePowerUps(game);
float rot = RotationSpeed;
if (SlowTurnTimer > 0) rot /= 3;
if ((input & 0x2) != 0) // turn left
Angle -= rot;
if ((input & 0x1) != 0) // turn right
Angle += rot;
Vector2 speed = new Vector2(0, 0);
speed.X = (float)(Math.Cos(Angle) * CurrentSpeed);
speed.Y = (float)(Math.Sin(Angle) * CurrentSpeed);
Position += speed;
if (WallhackTimer > 0)
{
Vector2 deltaPos = new Vector2(0, 0);
if (Position.X > Game1.ScreenWidth)
deltaPos.X = -Game1.ScreenWidth;
if (Position.X < 0)
deltaPos.X = +Game1.ScreenWidth;
if (Position.Y > Game1.ScreenHeight)
deltaPos.Y = -Game1.ScreenHeight;
if (Position.Y < 0)
deltaPos.Y = +Game1.ScreenHeight;
if (deltaPos != Vector2.Zero)
{
LayWall(game, true);
Position += deltaPos;
LastPos += deltaPos;
OlderPos += deltaPos;
}
}
foreach (Wall wall in game.Walls)
{
if ((WallhackTimer > 0) && (wall.Owner == null))
continue;
if ((game.Ticks - wall.LayTime < 30 && wall.IsOwner(this)) || (WallhackTimer > 0))
continue;
Vector2 e, f, g;
float l, skait, var;
f = wall.p2 - wall.p1;
e = Position - wall.p1;
g = OlderPos - Position;
skait = f.X * e.Y - e.X * f.Y;
var = g.X * f.Y - f.X * g.Y;
if (Math.Abs(var) > 0.001)
{
l = skait / var;
float l1 = (e.X * g.Y - g.X * e.Y) / -var;
if (l1 >= 0 && l1 <= 1 && l >= 0 && l <= 1 && game.WinningTeam == null)
{
Position = wall.p1 + e + g * l;
game.Walls.Add(new Wall(LastPos, Position, Color, game.Ticks, this));
this.Dead = true;
Team.UpdateAliveStatus();
game.AddScore(Team);
Team.TestIfEnded(game);
return;
}
}
}
if (LayWallDelay < 0)
{
LastPos = OlderPos = Position;
}
LayWallDelay++;
GapTimer--;
if (LayWallDelay > 6)
{
LayWall(game, false);
OlderPos = LastPos;
LastPos = Position;
LayWallDelay = 0;
}
else if (GapTimer < 0)
//.........这里部分代码省略.........