Ejemplo n.º 1
0
        public void SetPointers(SimpleMap map, ObjectRenderer renderer, List<long> ignoreTokens)
        {
            // Store Stuff
            _map = map;
            _ignoreTokens = ignoreTokens;

            // Make my picturebox look like what the renderer is painting on
            pictureBox1.BackColor = renderer.Viewer.BackColor;
            pictureBox1.SetBorder(renderer.Viewer.BoundryLower, renderer.Viewer.BoundryUpper);
            if (renderer.Viewer.ShouldDrawCheckerBackground)
            {
                pictureBox1.ShowCheckerBackground(renderer.Viewer.CheckerOtherColor, renderer.Viewer.NumCheckersPerSide);
            }
            else
            {
                pictureBox1.HideBackground();
            }

            if (renderer.Viewer.ShouldDrawBorder)
            {
                pictureBox1.ShowBorder(renderer.Viewer.BorderColor, renderer.Viewer.BorderWidth);
            }
            else
            {
                pictureBox1.HideBorder();
            }

            // I want my viewer to show the whole scene
            pictureBox1.ZoomFit();

            // Now clone the renderer
            _personalRenderer = new ObjectRenderer(pictureBox1);
        }
Ejemplo n.º 2
0
        public void SetPointers(LargeMapViewer2D picturebox, ShipController shipController, SimpleMap map)
        {
            _picturebox = picturebox;
            _shipController = shipController;
            _map = map;

            shipPropsMain1.SetPointers(picturebox, shipController);
            shipPropsTractor1.SetPointers(shipController, map);
            shipPropsGun1.SetPointers(shipController);

            _shipController.FinishedSetup();

            ShowPropertyTab(shipPropsMain1);
        }
Ejemplo n.º 3
0
        private Ball _drawingBall = null;		// ball is the lowest base class.  it could also be solidball or rigidbody

        //private double _diminishPercent = 1d;

        #endregion

        #region Constructor

        public BallAdder(LargeMapViewer2D picturebox, ObjectRenderer renderer, BallProps newBallProps, SimpleMap map, MyVector boundryLower, MyVector boundryUpper, List<long> tempObjects)
        {
            _picturebox = picturebox;
            _renderer = renderer;
            _newBallProps = newBallProps;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;
            _tempObjects = tempObjects;

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
        }
Ejemplo n.º 4
0
        public void SetPointers(ShipController shipController, SimpleMap map)
        {
            _shipController = shipController;
            _map = map;

            _shipController.CreateNewTractorBeams += new EventHandler(ShipController_CreateNewTractorBeams);
            _shipController.RecalcTractorBeamOffsets += new EventHandler(ShipController_RecalcTractorBeamOffsets);
            _shipController.ChangeTractorBeamPower += new EventHandler(ShipController_ChangeTractorBeamPower);

            // Apply Settings
            cboType_SelectedIndexChanged(this, new EventArgs());
            txtStrengthMax_TextChanged(this, new EventArgs());		// this method calls the trackbar methods
            txtMaxSize_TextChanged(this, new EventArgs());		// this method calls the trackbar's method
            trkSweepAngle_Scroll(this, new EventArgs());
        }
Ejemplo n.º 5
0
        public GravMouse(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
        {
            const double RADIUS = 400;

            _picturebox = picturebox;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;

            _cursorBlip = new BallBlip(new Ball(new MyVector(), new DoubleVector(1, 0, 0, 0, 1, 0), RADIUS, UtilityCore.GetMassForRadius(RADIUS, 1d), 1, 0, 0, _boundryLower, _boundryUpper), CollisionStyle.Stationary, RadarBlipQual.BallUserDefined05, TokenGenerator.NextToken());

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);
            _picturebox.MouseLeave += new EventHandler(picturebox_MouseLeave);
        }
Ejemplo n.º 6
0
        public Selector(LargeMapViewer2D picturebox, SimpleMap map, ObjectRenderer renderer, List<long> cantDeleteTokens)
        {
            _picturebox = picturebox;
            _map = map;
            _renderer = renderer;
            _cantDeleteTokens = cantDeleteTokens;

            _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown);
            _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp);
            _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove);

            _picturebox.KeyDown += new KeyEventHandler(picturebox_KeyDown);
            _picturebox.KeyUp += new KeyEventHandler(picturebox_KeyUp);
        }
Ejemplo n.º 7
0
        public static RadarBlip CloneBlip(RadarBlip blip, SimpleMap map)
        {
            BallBlip retVal = new BallBlip((Ball)blip.Sphere.Clone(), blip.CollisionStyle, blip.Qual, TokenGenerator.NextToken());
            retVal.Ball.Velocity.StoreNewValues(((Ball)blip.Sphere).Velocity);

            if (blip.Sphere is TorqueBall)
            {
                ((TorqueBall)retVal.Sphere).AngularMomentum.StoreNewValues(((TorqueBall)blip.Sphere).AngularMomentum);
            }

            return retVal;
        }
Ejemplo n.º 8
0
 public GravityController(SimpleMap map)
 {
     _map = map;
 }
Ejemplo n.º 9
0
        public ShipController(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
        {
            _picturebox = picturebox;
            _map = map;
            _boundryLower = boundryLower;
            _boundryUpper = boundryUpper;

            _blipToken = TokenGenerator.NextToken();

            _picturebox.KeyDown += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyDown);
            _picturebox.KeyUp += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyUp);
        }
Ejemplo n.º 10
0
        public Projectile(Ball ball, long shipToken, bool ignoreOtherProjectiles, double pain, SimpleMap map, RadarBlipQual blipQual, long token, Guid objectID)
            : base(ball, CollisionStyle.Standard, blipQual, token, objectID)
        {
            _shipToken = shipToken;
            _ignoreOtherProjectiles = ignoreOtherProjectiles;
            _pain = pain;
            _map = map;

            _map.Collisions += new CollisionsDelegate(Map_Collisions);
        }
Ejemplo n.º 11
0
 public Projectile(Ball ball, long shipToken, bool ignoreOtherProjectiles, double pain, SimpleMap map, RadarBlipQual blipQual, long token)
     : this(ball, shipToken, ignoreOtherProjectiles, pain, map, blipQual, token, Guid.NewGuid()) { }
Ejemplo n.º 12
0
        private void Exploding()
        {
            // Keep setting my velocity back to zero
            base.Ball.Velocity.StoreNewValues(new MyVector());

            // See if enough time has gone by
            bool isExpired = false;
            if (_explosion == null)
            {
                isExpired = true;
            }
            else
            {
                // Bump up my elapsed time
                _explosion.ElapsedTime += _curTickElapsedTime;

                if (_explosion.ElapsedTime > _explosion.Duration)
                {
                    isExpired = true;
                }
            }

            if (isExpired)
            {
                // Let myself know that I am in the process of dying
                _state = ProjectileState.Dying;

                // Tell the map to drop me, and drop reference to the map.
                _map.Remove(this.Token);
                _map.Collisions -= new CollisionsDelegate(Map_Collisions);
                _map = null;
            }
        }
Ejemplo n.º 13
0
        public TractorBeamCone(SimpleMap map, BallBlip ship, MyVector offset, DoubleVector dirFacing, BeamMode mode, bool isSoft, double sweepAngle, double maxDistance, double forceAtZero, double forceAtMax, double maxForcePerTick)
        {
            _map = map;

            _ship = ship;

            _offset = offset;
            _dirFacing = dirFacing;

            _mode = mode;

            _isSoft = isSoft;

            _sweepAngle = sweepAngle;
            _maxDistance = maxDistance;
            _forceAtZero = forceAtZero;
            _forceAtMax = forceAtMax;
            _maxForcePerTick = maxForcePerTick;
        }
Ejemplo n.º 14
0
        public ProjectileWeapon(double projectilePain, double projectileRadius, double projectileMass, double projectileSpeed, bool produceKick, bool ignoreOtherProjectiles, RadarBlipQual projectileQual, bool enforceFiringModeOuterTime, SimpleMap map, MyVector boundryLower, MyVector boundryUpper)
        {
            _projectileSettings = new ProjectileSettings(projectileSpeed, projectileRadius, projectileMass, projectilePain, ignoreOtherProjectiles, projectileQual);
            _enforceFiringModeOuterTime = enforceFiringModeOuterTime;
            _map = map;
            _produceKick = produceKick;

            if (boundryLower != null && boundryUpper != null)
            {
                _useBoundry = true;
                _boundryLower = boundryLower;
                _boundryUpper = boundryUpper;
            }

            _elapsedTime = new FiringMode(0, 0, 0);
        }
Ejemplo n.º 15
0
 public ProjectileWeapon(double projectilePain, double projectileRadius, double projectileMass, double projectileSpeed, bool produceKick, bool ignoreOtherProjectiles, RadarBlipQual projectileQual, bool enforceFiringModeOuterTime, SimpleMap map)
     : this(projectilePain, projectileRadius, projectileMass, projectileSpeed, produceKick, ignoreOtherProjectiles, projectileQual, enforceFiringModeOuterTime, map, null, null) { }