Exemplo n.º 1
0
 public PingMine(Player owner, float angle, World world, MainGameScreen game, Color color)
 {
     this.owner = owner;
     this.world = world;
     this.game = game;
     this.color = color;
     body = BodyFactory.CreateRectangle(world, ConvertUnits.ToSimUnits(10f), ConvertUnits.ToSimUnits(3f), 1f, owner.Body.Position);
     body.BodyType = BodyType.Dynamic;
     body.UserData = "invisible";
     body.IsBullet = true;
     body.Rotation = angle + MathHelper.PiOver2;
     Vector2 impulse = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * 0.01f;
     body.ApplyLinearImpulse(impulse);
     body.OnCollision += body_OnCollision;
     traveling = true;
     sonarRotation = 0;
     sonarDistance = 150f;
     sonarPoints = new List<TempPingInstance>();
     sonarPings = new List<TempPingInstance>();
     sonarResolution = 1000f;
     reverseRotation = false;
 }
Exemplo n.º 2
0
        public Player(MainGameScreen game, Vector2 position, World world, Color color)
        {
            this.game = game;
            this.world = world;
            this.color = color;

            texture = game.ResourceManager.Sprites["Submarine"];
            body = ResourceManager.CreateBodyFromTexture(texture, position, world, out origin);
            sonarPings = new List<TempPingInstance>();
            sonarPoints = new List<TempPingInstance>();
            points = new List<TempPingInstance>();
            horizontalSpeed = 0.002f;
            verticalSpeed = 0.001f;
            sonarDistance = 1000f;
            sonarIterations = 800f;
            sonarRotation = 0;
            numPings = 550;
            pingDuration = 10000f;
            pingDistance = 3000f;
            ping = new TempPing(0);
            pingMines = new List<PingMine>();
        }