Ejemplo n.º 1
0
 public cCritterBossDragonKnight(cGame3D pownergame, cVector3 position, cCritterBullet bullet, float firerate = 4.0f, int health = 20, int model = 7)
     : base(pownergame, position, model, bullet, firerate, health)
 {
     setRadius(4.0f);
     //custom animation frames
     Sprite.setstate(State.Other, 53, 63, StateType.Repeat);
 }
Ejemplo n.º 2
0
        public override cCritterBullet shoot()
        {
            cCritterBullet newBullet = base.shoot();

            newBullet.Velocity = _aimvector.mult(15.0f);
            return(newBullet);
        }
Ejemplo n.º 3
0
        public cCritterBoss(cGame pownergame, cVector3 position, int model, cCritterBullet bullet, float firerate, int health)
            : base(pownergame)
        {
            addForce(new cForceGravity(25.0f, new cVector3(0.0f, -1, 0.00f)));
            addForce(new cForceDrag(20.0f));  // default friction strength 0.5
            addForce(new CenteringForce());

            Density  = 2.0f;
            MaxSpeed = 30.0f;
            facing   = false;
            if (pownergame != null) //Just to be safe.
            {
                Sprite = new cSpriteQuake(model);
            }

            // example of setting a specific model
            // setSprite(new cSpriteQuake(ModelsMD2.Knight));

            if (Sprite.IsKindOf("cSpriteQuake")) //Don't let the figurines tumble.
            {
                AttitudeToMotionLock = false;
                Attitude             = new cMatrix3(new cVector3(0.0f, 0.0f, 1.0f),
                                                    new cVector3(1.0f, 0.0f, 0.0f),
                                                    new cVector3(0.0f, 1.0f, 0.0f), Position);
                /* Orient them so they are facing towards positive Z with heads towards Y. */
            }
            Bounciness = 0.0f;              //Not 1.0 means it loses a bit of energy with each bounce.
            setRadius(1.0f);
            MinTwitchThresholdSpeed = 4.0f; //Means sprite doesn't switch direction unless it's moving fast
            moveTo(position);
            /* I put them ahead of the player  */
            randomizeVelocity(0.0f, 30.0f, false);

            int begf = Framework.randomOb.random(0, 171);
            int endf = Framework.randomOb.random(0, 171);

            if (begf > endf)
            {
                int temp = begf;
                begf = endf;
                endf = temp;
            }

            setTarget(Player);

            Sprite.setstate(State.Other, begf, endf, StateType.Repeat);

            BulletClass = bullet;

            WaitShoot = firerate;
            Health    = health;

            _wrapflag = cCritter.BOUNCE;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Standard shoot function, but adds the player's velocity to the bullet because otherwise if
        /// you're moving forward, the bullets pile up.
        /// </summary>
        /// <returns></returns>
        public override cCritterBullet shoot()
        {
            cCritterBullet pbullet = base.shoot();

            /* I used to just have
             * pbullet->addVelocity(_velocity), but this gives unattractive results. */
            float bulletspeedup = _velocity.mod(pbullet.Tangent);

            if (bulletspeedup > 0.0f)
            {
                pbullet.addVelocity(pbullet.Tangent.mult(bulletspeedup)); //So bullets don't stack up.
            }
            return(pbullet);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates a bullet, initializes it, adds it to the list of critters, and adds it to the bullet list.
        /// It is returned in case the shooter wants to do anything else with it.
        /// </summary>
        /// <returns></returns>
        public virtual cCritterBullet shoot()
        {
            cCritterBullet pbullet = _pbulletclass.Create();

            pbullet.initialize(this);
            pbullet.Sprite.LineColor = Sprite.LineColor;
            pbullet.add_me(_pownerbiota); /* Makes a servicerequest to be handled by cBiota later. I used to
                                           * have _pownerbiota.Add(pbullet) here, but this makes a problem if I do
                                           * USEMETRIC; this is because _metric expects the critter's indices to stay fixed.
                                           * In general, I should not be adding or deleting any critters except
                                           * in the cBiota.processervicerequests call. Note that you have the default
                                           * FALSE value of the immediateadd argument to add_me, meaning you don't
                                           * add in this critter to the simulator cBiota until it finishes its current
                                           * update loop and has a chance to call processServiceRequests. */
            _bulletlist.Add(pbullet);     //Adds to end of my personal bullet-data array.
            return(pbullet);              /* In case you want to overload cCritterArmed.shoot to do something else to
                                           * the bullet. */
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Deletes a bullet from the _bulletlist
        /// </summary>
        /// <param name="pbullet">The bullet to remove.</param>
        public void removeBullet(cCritterBullet pbullet)
        {
            if (_bulletlist.Size == 0)
            {
                return;
            }

            cCritterBullet cb;

            _bulletlist.First(out cb);

            do
            {
                if (_bulletlist.ElementAt() == pbullet)
                {
                    _bulletlist.RemoveNext();
                    break;
                }
            } while (_bulletlist.GetNext(out cb));
        }
 public cCritterBossDrFreak(cGame3D pownergame, cVector3 position, cCritterBullet bullet, float firerate = 4.0f, int health = 20, int model = 6)
     : base(pownergame, position, model, bullet, firerate, health)
 {
 }