Exemple #1
0
        public cCritter3DPlayer(cGame pownergame)
            : base(pownergame)
        {
            BulletClass           = new cCritter3DPlayerBullet( );
            Sprite                = new cSpriteQuake(ModelsMD2.Starfox);
            Sprite.SpriteAttitude = cMatrix3.scale(2, 0.8f, 0.4f);
            setRadius(cGame3D.PLAYERRADIUS);               //Default cCritter.PLAYERRADIUS is 0.4.
            setHealth(10);
            moveTo(_movebox.LoCorner + new cVector3(0.0f, 0.0f, 2.0f));
            WrapFlag             = cCritter.CLAMP; //Use CLAMP so you stop dead at edges.
            Armed                = true;           //Let's use bullets.
            MaxSpeed             = cGame3D.MAXPLAYERSPEED;
            AbsorberFlag         = true;           //Keeps player from being buffeted about.
            ListenerAcceleration = 160.0f;         //So Hopper can overcome gravity.  Only affects hop.

            // YHopper hop strength 12.0
            Listener = new cListenerScooterYHopper(0.2f, 12.0f);
            // the two arguments are walkspeed and hop strength -- JC

            addForce(new cForceGravity(50.0f));    /* Uses  gravity. Default strength is 25.0.
                                                    * Gravity	will affect player using cListenerHopper. */
            AttitudeToMotionLock = false;          //It looks nicer is you don't turn the player with motion.
            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);
        }
Exemple #2
0
 public cCritter3DBoss(cGame pownergame = null) :
     base(pownergame)
 {
     if (pownergame != null)
     {
         rand        = new Random();
         BulletClass = new cCritterBulletRubber();
         //Sets the boss sprite
         Sprite = new cSpriteQuake(ModelsMD2.Vegeta);
         setHealth(20);
         WrapFlag     = cCritter.CLAMP;         //Prevents boss from going through walls
         Armed        = true;                   //Allows the character to use bullets
         MaxSpeed     = cGame3D.MAXPLAYERSPEED; //sets max speed
         AbsorberFlag = true;                   //Keeps boss from being buffered out
         addForce(new cForceGravity(50.0f));    //gravity
         AttitudeToMotionLock = false;
         //First param determines direction facing (forward/backward)
         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);
         AimToAttitudeLock = true;   //aims in the direction of the attitude
         setMoveBox(_movebox);
         moveTo(new cVector3(_movebox.Midx, _movebox.Loy,
                             _movebox.Midz + 2.0f));
         //Sets the direction the boss is moving to the direction they are facing
         addForce(new cForceObjectSeek(Player, 3.0f));
         _waitshoot = (float)rand.NextDouble();
         setMoveBox(_movebox);
     }
 }
Exemple #3
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);
        }
Exemple #4
0
        public cCritter3Dcharacter(cGame pownergame)
            : base(pownergame)
        {
            _health = 2;

            addForce(new cForceObjectSeek(Player, 15.5f));
            addForce(new cForceGravity(25.0f, new cVector3(0.0f, -1, 0.00f)));
            addForce(new cForceDrag(2.0f));                  // default friction strength 0.5
            Density  = 2.0f;
            MaxSpeed = 30.0f;
            if (pownergame != null) //Just to be safe.
            {
                Sprite = new cSpriteQuake(Framework.models.selectRandomCritter());
            }

            // 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
            randomizePosition(new cRealBox3(new cVector3(_movebox.Lox, _movebox.Loy, _movebox.Loz + 4.0f),
                                            new cVector3(_movebox.Hix, _movebox.Loy, _movebox.Midz - 1.0f)));
            /* I put them ahead of the player  */
            randomizeVelocity(0.0f, 30.0f, false);


            if (pownergame != null)               //Then we know we added this to a game so pplayer() is valid
            {
                addForce(new cForceObjectSeek(Player, 0.5f));
            }

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

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

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


            _wrapflag = cCritter.BOUNCE;
        }
Exemple #5
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;
        }
Exemple #6
0
 public cCritterWank(cGame pownergame)
     : base(pownergame)
 {
     //Sets the sprite
     Sprite       = new cSpriteQuake(ModelsMD2.Wank);
     WrapFlag     = cCritter.CLAMP;         //Prevent from going through walls
     MaxSpeed     = cGame3D.MAXPLAYERSPEED; //sets max speed
     AbsorberFlag = true;                   //Keep from being buffered out
     addForce(new cForceGravity(50.0f));    //gravity
     AttitudeToMotionLock = false;
     //First param determines direction facing (forward/backward)
     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);
     Sprite.setstate(State.Other, stateBegF, stateEndF, StateType.Repeat);
 }
Exemple #7
0
 public cCritter3DCharacterEnemy(cGame pownergame)
     : base(pownergame)
 {
     Sprite = new cSpriteQuake(ModelsMD2.Enemy);
     Sprite.setstate(State.Other, begf, endf, StateType.Repeat);
     WrapFlag     = cCritter.CLAMP;                 //Prevents boss from going through walls
     Armed        = false;                          //Allows the character to use bullets
     MaxSpeed     = cGame3D.MAXPLAYERSPEED - 15.0f; //sets max speed
     AbsorberFlag = true;                           //Keeps boss from being buffered out
     addForce(new cForceGravity(50.0f));            //gravity
     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);
     addForce(new cForceObjectSeek(Player, 3.0f));
     AimToAttitudeLock = true;   //aims in the direction of the attitude
 }
Exemple #8
0
        public cCritterBoss(cGame pOwnerGame = null) : base(pOwnerGame)
        {
            MaxSpeed = 40;
            Health   = 5;
            ForceList.RemoveAll();
            ForceList.Add(new cForceBossMovement(150000.0f));
            Sprite = new cSpriteQuake(ModelsMD2.Eva01);
            Radius = 3;
            moveTo(new cVector3(Game.Border.Midx, Game.Border.Loy, Game.Border.Midz));
            Target            = Game.Player;
            AimToAttitudeLock = false;
            //copyMotionMatrixToAttitudeMatrix();
            AttitudeToMotionLock = false;
            BULLETRADIUS         = 0.4f;
            setMoveBox(new cRealBox3(new cVector3(Game.Border.Lox, Game.Border.Loy, Game.Border.Loz + 3),
                                     new cVector3(Game.Border.Hix, Game.Border.Hiy, Game.Border.Hiz - 3)));

            //set upright
            rotateAttitude(new cSpin((float)Math.PI * 3f / 2f, new cVector3(1, 0, 0)));
            //set looking left
            rotateAttitude(new cSpin((float)Math.PI * 3f / 2f, new cVector3(0, 0, 1)));
            _dead = false;
        }
Exemple #9
0
 public cCritterMinion(cGame pOwnerGame) : base(pOwnerGame)
 {
     ForceList.Add(new cForceMinionMovement(pOwnerGame.Player));
     Sprite        = new cSpriteQuake(ModelsMD2.Hunter);
     Sprite.Radius = 1;
 }