public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     Sprite.FillColor = Color.Crimson;
     // can use setSprite here too
     setRadius(0.1f);
 }
Esempio n. 2
0
        public override cCritter copy()
        {
            cCritterArmed c = new cCritterArmed();

            c.copy(this);
            return(c);
        }
Esempio n. 3
0
        /// <summary>
        /// Orients the bullet so that it has the same attitude as the shooter, and sets the Tangent of the bullet.
        /// The Target and WrapFlag of the bullet is set to that of the shooter.  The bullet is also set to its
        /// starting position.
        /// </summary>
        /// <param name="pshooter">The shooter of this bullet.</param>
        public virtual void initialize(cCritterArmed pshooter)
        {
            _pshooter = pshooter;
            setMoveBox(_pshooter.OwnerBiota.border()); /* Be sure to call setMoveBox before setVelocity,
                                                        * as setVelocity generates a call to fixNormalAndBinormal which looks at _movebox to see
                                                        * if it's ok if you happen to have a 3D velocity. */
            DragBox  = _pshooter.OwnerBiota.border();
            Attitude = _pshooter.Attitude;             //Orient the bullet like the shooter, fix position below.
            Tangent  = _pshooter.AimVector;            /* This call uses the _bulletspeed set by the
                                                       *  cBullet constructor and the direction of the aim.  We choose NOT to add
                                                       *  _pshooter->velocity() to the new velocity. */
            setTarget(_pshooter.Target);
            WrapFlag = _pshooter.WrapFlag;
            cVector3 start = _pshooter.Position; //position()

            /* I want to start the bullet out at the tip of the gun, with the provision
             * that in any case I will I start it out far enough so that it's not touching
             * the shooter. */
            float bulletdistance1 = _pshooter.GunLength * _pshooter.Radius;
            float bulletdistance2 = pshooter.Radius + 1.5f * BULLETRADIUS; /* Need the 1.5 for enough
                                                                            * room. Otherwise when the simulation is slow you may still touch. */
            float bulletdistance  = (bulletdistance1 > bulletdistance2) ? bulletdistance1
                : bulletdistance2;
            cVector3 end = start.add(_pshooter.AimVector.mult(bulletdistance));

            moveTo(end); //Do this instead of just setting _position so as to fix wrapposition
        }
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     Sprite           = new cSpriteSphere();
     Sprite.FillColor = Color.Orange;
     setRadius(minRadius);
 }
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     _hitstrength = 1;
     Sprite       = new cSpriteSphere();
     //Maybe add some kind of bitmap to bullet
     Sprite.FillColor = Color.Red;
     setRadius(radius);
 }
Esempio n. 6
0
        public override void initialize(cCritterArmed pshooter)
        {
            base.initialize(pshooter);

            Sprite = new cSpriteQuake(ModelsMD2.Sorcerer);
            Sprite.SpriteAttitude = cMatrix3.scale(2, 0.8f, 0.4f);

            // can use setSprite here too
            setRadius(0.1f);
        }
        public override void initialize(cCritterArmed pshooter)
        {
            base.initialize(pshooter);

            _hitstrength     = 0;
            Sprite           = new cSpriteSphere();
            Sprite.FillColor = Color.Orange;
            setRadius(0.4f);
            this._fixedlifetime = 10.0f;
            this.Speed          = 3.0f;
        }
Esempio n. 8
0
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);
     if (((cCritter3DPlayer)pshooter).Mode == 'K')
     {
         Sprite           = new cSpriteSphere();
         Sprite.FillColor = Color.Blue;
         setRadius(0.4f);
         HitStrength = 2;
     }
     else if (((cCritter3DPlayer)pshooter).Mode == 'S')
     {
         Sprite.FillColor = Color.Crimson;
         // can use setSprite here too
         setRadius(0.1f);
     }
 }
        //Nonserialized pointer ref.

        public cCritterBullet()
        {
            _pshooter         = null;
            _shooterindex     = cBiota.NOINDEX;
            _hitstrength      = 1;
            _dieatedges       = true;
            _defaultprismdz   = cSprite.BULLETPRISMDZ;
            _value            = 0;
            _usefixedlifetime = true;
            _fixedlifetime    = FIXEDLIFETIME;
            _collidepriority  = cCollider.CP_BULLET; /* Don't use the setCollidePriority mutator, as that
                                                      * forces a call to pgame()->buildCollider(); */
            _maxspeed         = cCritterBullet.MAXSPEED;
            Speed             = cCritterBullet.BULLETSPEED;
            cSpriteSphere bulletsprite = new cSphere(cCritter.BULLETRADIUS, Color.Yellow);

            Sprite = bulletsprite;             /* Also sets cSprite._prismdz to cCritter._defaultprismdz, which we
                                                * set to CritterWall.BULLETPRISMDZ above. */
        }
Esempio n. 10
0
        public override void copy(cCritter pcritter)
        {
            /*We need to overload the cCritter copy because if I have cCritterArmedRobot which is
             * a cCritterArmed, and it gets split in two by a replicate call, then I want the new
             * copy to have all the same shooting behavior as the old one.  In general, I should
             * overload copy for each of my critter child classes, but for now this one is the
             * most important.  The overload does the regular copy, then looks if the thing
             * being copied is a cCritterArmed, and if it is then it copies the additional fields. */
            base.copy(pcritter);
            if (!pcritter.IsKindOf("cCritterArmed"))
            {
                return;                                              //You're done if pcritter isn't a cCritterArmed*.
            }
            cCritterArmed pcritterarmed = (cCritterArmed)(pcritter); /* I know it is a
                                                                      * cCritterArmed at this point, but I need to do a cast, so the compiler will let me
                                                                      * call a bunch of cCritterArmed methods. */

            _armed             = pcritterarmed._armed;
            _aimvector         = pcritterarmed._aimvector;
            _waitshoot         = pcritterarmed._waitshoot;
            _aimtoattitudelock = pcritterarmed._aimtoattitudelock;
            BulletClass        = pcritterarmed._pbulletclass;
        }
Esempio n. 11
0
 /// <summary>
 /// Orients the bullet so that it has the same attitude as the shooter, and sets the Tangent of the bullet.
 /// The Target and WrapFlag of the bullet is set to that of the shooter.  The bullet is also set to its
 /// starting position.  Adds the force cForceObjectSeek on the Target, using a force strength of
 ///  cCritterBulletSilverMissile.CHASEACCELERATION
 /// </summary>
 /// <param name="pshooter">The shooter of this bullet.</param>
 public override void initialize(cCritterArmed pshooter)
 {
     base.initialize(pshooter);  // calls the cCritterBullet initialize
     addForce(
         new cForceObjectSeek(Target, cCritterBulletSilverMissile.CHASEACCELERATION));
 }
Esempio n. 12
0
        //Accessor

        /// <summary>
        /// Don't call this; it should only be called by cCritterArmed.destruct
        /// </summary>
        public void nullTheShooter()
        {
            _pshooter = null;
        }