当前位置: 首页>>代码示例>>C#>>正文


C# Game1.AddScore方法代码示例

本文整理汇总了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)
//.........这里部分代码省略.........
开发者ID:popoffka,项目名称:Achtung,代码行数:101,代码来源:Player.cs


注:本文中的Game1.AddScore方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。