Exemplo n.º 1
0
        public bool scanTarget()
        {
            detectionCircle = new Circle(position, sensorDistance);

            if (TankGame.CircleRectangleIntersection(detectionCircle, tankCollisionRectangle))
            {
                missile = new Missile(game, new Vector2(tankPosition.X + missileOffset));
                Game.Components.Add(missile);

                target = new TargetLocked(game, new Vector2(tankPosition.X + tankSize.X / 2, tankPosition.Y + tankSize.Y / 2));
                target.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

                target.UpdateOrder = 100;
                target.DrawOrder   = 100;
                target.Visible     = true;

                targetLockedOn = true;
            }
            else
            {
                targetLockedOn = false;
            }

            bulletCollided();

            return(targetLockedOn);
        }
Exemplo n.º 2
0
        public bool scanTarget()
        {
            detectionCircle = new Circle(position, sensorDistance);

            if (TankGame.CircleRectangleIntersection(detectionCircle, tankCollisionRectangle))
            {
                missile = new Missile(game, new Vector2(tankPosition.X + missileOffset));
                Game.Components.Add(missile);

                target = new TargetLocked(game, new Vector2(tankPosition.X + tankSize.X / 2, tankPosition.Y + tankSize.Y / 2));
                target.AutoInitialize(game.GraphicsDevice, game.Content, TankGame.spriteBatch);

                target.UpdateOrder = 100;
                target.DrawOrder = 100;
                target.Visible = true;

                targetLockedOn = true;
            }
            else
            {
                targetLockedOn = false;
            }

            bulletCollided();

            return targetLockedOn;
        }