Example #1
0
 public override bool collide(cCritter pcritter)
 {
     if (Position.distanceTo(pcritter.Position) < collideRadius)
     {
         pcritter.moveTo(pcritter.OldPosition);
         return(true);
     }
     return(false);
 }
Example #2
0
 public cVector3 pixelToCritterYonWallVector(int xpix, int ypix,
                                             cCritter pcritter, float distancetoyon)
 {
     return(_pgraphics.pixelAndPlaneToVector(xpix, ypix,
                                             new cPlane(
                                                 pcritter.Position.add(pcritter.AttitudeTangent.mult(distancetoyon)),
                                                 pcritter.AttitudeTangent.neg())));
     //The two args to cPlane constructor are (origin, binormal), origin meaning a point on the plane.
 }
Example #3
0
     public override int collidesWith(cCritter pcritterother)
     {
         /* Make sure I don't ever waste time colliding walls with
 walls. I only call this the one time that I enroll the cCritterWall
  into the cGame's _pcollider. */
         if (pcritterother.IsKindOf("cCritterWall"))
             return cCollider.DONTCOLLIDE;
         return base.collidesWith(pcritterother);
     }
Example #4
0
 public override void copy(cCritter pcritter)
 {
     base.copy(pcritter);
     if (!pcritter.IsKindOf("cCritter3DBoss"))
     {
         return;
     }
     cCritter3DBoss pcritterplayer = (cCritter3DBoss)(pcritter);
 }
        public override bool collide(cCritter pcritter)
        {
            bool collided = base.collide(pcritter);

            if (collided)
            {
                pcritter.addForce(new KnockbackForce(forceVector)); //clear forcelist before this?
            }
            return(collided);
        }
Example #6
0
 public override bool collide(cCritter pother)
 {
     if (pother.IsKindOf("cCritter3DPlayer"))
     {
         //move away from player
         addForce(new cForceClassEvade(0.3f, 0.3f));
         return(true);
     }
     return(false);
 }
Example #7
0
        public override void copy(cForce pforce)
        {
            base.copy(pforce);
            if (!(pforce is cForceObject))
            {
                return;
            }
            cForceObject pForceObject = ( cForceObject )(pforce);

            _pnode = pForceObject._pnode;             //Want a shallow copy
        }
        //Checks if pcritter inside.

        public override int collidesWith(cCritter pothercritter)
        {
            if (pothercritter is cCritter3DPlayer)
            {
                return(cCollider.COLLIDEASCALLER);
            }
            else
            {
                return(cCollider.DONTCOLLIDE);
            }
        }
 public override bool collide(cCritter pcritter)
 {
     if (pcritter.IsKindOf("cCritterViewer"))
     {
         return(false);
     }
     else
     {
         return(base.collide(pcritter));
     }
 }
Example #10
0
 public override int collidesWith(cCritter pcritterother)
 {
     /* Make sure I don't ever waste time colliding walls with
      * walls. I only call this the one time that I enroll the cCritterWall
      * into the cGame's _pcollider. */
     if (pcritterother is cCritterWall)
     {
         return(cCollider.DONTCOLLIDE);
     }
     return(base.collidesWith(pcritterother));
 }
        public override bool collide(cCritter pcritter)
        {
            bool collided = base.collide(pcritter);

            if (collided && pcritter is cCritter3DPlayer)
            {
                (( cGame3D )Game).setdoorcollision( );
                return(true);
            }
            return(false);
        }
Example #12
0
 public override bool collide(cCritter pcritter)
 {
     if (pcritter.IsKindOf("cCritterWank") || pcritter.IsKindOf("cCritterDragonball"))
     {
         return(false);
     }
     else
     {
         return(base.collide(pcritter));
     }
 }
Example #13
0
        public override void copy(cForce pforce)
        {
            base.copy(pforce);
            if (!pforce.IsKindOf("cForceMinionMovement"))
            {
                return;
            }
            cForceMinionMovement pforcechild = (cForceMinionMovement)pforce;

            moveTowards = pforcechild.moveTowards;
        }
Example #14
0
        public override bool collide(cCritter pcritter)
        {
            bool collided   = base.collide(pcritter);
            bool killedBoss = ((cGame3D)Game).IsBossDead(); //Can only enter the door if the boss is killed

            if (collided && pcritter.IsKindOf("cCritter3DPlayer") && killedBoss)
            {
                (( cGame3D )Game).setdoorcollision( );
                return(true);
            }
            return(false);
        }
Example #15
0
 public override bool collide(cCritter pother)
 {
     if (pother.IsKindOf("cCritter3DPlayer"))
     {
         return(true);
     }
     else if (pother.IsKindOf("cCritter3DPlayerBullet"))
     {
         return(true);
     }
     return(false);
 }
Example #16
0
        public override bool collide(cCritter pcritter)
        {
            bool collided = base.collide(pcritter);

            if (collided && pcritter.IsKindOf("cCritter3DPlayer"))
            {
                (( cGame3D )Game).setdoorcollision( );
                hitDoor = true;
                return(true);
            }
            return(false);
        }
Example #17
0
 public override cVector3 force(cCritter pcritter)
 {
     if (Math.Abs(moveTowards.Position.X - pcritter.Position.X) < 1)
     {
         pcritter.Sprite.ModelState = State.Run;
         return(new cVector3(0, 0, 150));//(pcritter.Position.Z - moveTowards.Position.Z) * 100);
     }
     else
     {
         pcritter.Sprite.ModelState = State.CrouchCrawl;
         return(new cVector3((moveTowards.Position.X - pcritter.Position.X) * 50, 0, 0));
     }
 }
Example #18
0
 public override bool collide(cCritter pCritter)
 {
     if (contains(pCritter)) //disk of pcritter is wholly inside my disk
     {
         pCritter.addHealth(-1);
         pCritter.moveTo(new cVector3(_movebox.Midx, _movebox.Loy + 1.0f,
                                      _movebox.Hiz - 3.0f));
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #19
0
 public override bool collide(cCritter pother)
 {
     if (base.collide(pother))
     {
         if (pother.IsKindOf("cCritter3DPlayer"))
         {
             Framework.snd.play(Sound.GlassBreaking);
             pother.addScore(12);
             pother.addVelocity(new cVector3(0, 0, -5));
         }
         return(true);
     }
     return(false);
 }
Example #20
0
 /// <summary>
 /// The purpose of this function is to ignore colliding with bullets from the same shooter.  If the shooter
 /// is dead (null), it will also ignore bullet collisions from other dead shooters.  Also, will not let a bullet from
 /// a shooter bump into the shooter.
 /// </summary>
 /// <param name="pcritter">The critter this bullet is bumping into.</param>
 /// <returns></returns>
 public override int collidesWith(cCritter pcritter)
 {
     if (pcritter.IsKindOf("cCritterBullet") &&
         ((cCritterBullet)pcritter).Shooter == _pshooter) // Can be NULL
     {
         return(cCollider.DONTCOLLIDE);
     }
     //Don't bump into your shooter.
     if (pcritter == _pshooter)
     {
         return(cCollider.DONTCOLLIDE);
     }
     return(base.collidesWith(pcritter));
 }
Example #21
0
        /// <summary>
        /// If player has collided with a nonwall critter, and _sensitive has been set to true, this will
        /// damage the player by 1 point.
        /// </summary>
        /// <param name="pcritter"></param>
        /// <returns></returns>
        public override bool collide(cCritter pcritter)
        {
            if (_baseAccessControl == 1)
            {
                return(base.collide(pcritter));
            }
            bool collided = base.collide(pcritter);  // will call cCritter collide

            if (collided && _sensitive && !pcritter.IsKindOf("cCritterWall"))
            {
                damage(1);
            }
            return(collided);
        }
Example #22
0
        public override bool collide(cCritter pcritter)
        {
            if (pcritter.IsKindOf("KnockbackBullet"))
            {
                return(false);
            }

            bool collided = base.collide(pcritter);

            if (Player.Shield)
            {
                pcritter.damage(5);
            }
            return(collided);
        }
Example #23
0
 public override cVector3 force(cCritter pcritter)
 {
     if (_pnode == null)
     {
         return(new cVector3(0.0f, 0.0f, 0.0f));
     }
     if (pcritter.distanceTo(_pnode) < _rodlength)
     {
         pcritter.moveTo(_pnode.Position +
                         _pnode.directionTo(pcritter) * _rodlength, true);            /* The TRUE arg means
                                                                                       * to allow the motion cause a change in pcritter's _tangent, _normal, etc. */
         return(new cVector3(0.0f, 0.0f, 0.0f));
     }
     return(_pnode.Position - pcritter.Position * _intensity);
 }
 public override bool collide(cCritter pcritter)
 {
     if (contains(pcritter))                //disk of pcritter is wholly inside my disk
     {
         Framework.snd.play(Sound.Clap);
         pcritter.addScore(100);
         pcritter.addHealth(1);
         pcritter.moveTo(new cVector3(_movebox.Midx, _movebox.Loy + 1.0f,
                                      _movebox.Hiz - 3.0f));
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #25
0
        public override cVector3 force(cCritter pcritter)
        {
            if (_pnode == null)
            {
                return(new cVector3(0.0f, 0.0f, 0.0f));
            }
            cVector3 pursueforcevector =
                (pcritter.directionTo(_pnode).mult(pcritter.MaxSpeed)).sub(pcritter.Velocity);

            pursueforcevector.Magnitude = _intensity + 2; //increase the intensity, stronger the 'seek' force
            pursueforcevector.multassign(pcritter.Mass);
            cVector3 p = new cVector3();

            p.copy(pursueforcevector);
            return(p);
        }
Example #26
0
        public override cVector3 force(cCritter pcritter)
        {
            //cCritterBoss boss = (cCritterBoss)pcritter;
            if (pcritter.Position.X < pcritter.Player.Position.X)
            {
                //Console.WriteLine("boss is less");
                return(new cVector3(5.0f, 0, 0));
            }
            else if (pcritter.Position.X > pcritter.Player.Position.X)
            {
                //Console.WriteLine("boss is more");
                return(new cVector3(-5.0f, 0, 0));
            }

            return(new cVector3(0, 0, 0));
        }
Example #27
0
        public override cVector3 force(cCritter pcritter)
        {
            if (_pnode == null)
            {
                return(new cVector3(0.0f, 0.0f, 0.0f));
            }
            cVector3 pursueforcevector =
                (pcritter.directionTo(_pnode) * pcritter.MaxSpeed) - pcritter.Velocity;

            pursueforcevector.Magnitude = _intensity;
            pursueforcevector          *= pcritter.Mass;
            cVector3 p = new cVector3();

            p.copy(pursueforcevector);
            return(p);
        }
        public override bool collide(cCritter pcritter)
        {
            bool collided = base.collide(pcritter);

            if (collided && pcritter.IsKindOf("cCritter3DPlayer"))
            {
                count++;
                cCritter3DPlayer player = (cCritter3DPlayer)pcritter;
                if (count >= DELAY)
                {
                    player.damage(DAMAGE);
                    count = 0;
                }
            }

            return(collided);
        }
Example #29
0
        public override void animate(float dt, cCritter powner)
        {
            bool first = true;

            foreach (cSprite s in _childspriteptr)
            { //Tp oOnly rotate the tip shapes and not base, start with 2nd element
                if (!first)
                {
                    _childspriteptr.ElementAt().rotate(dt * _tipangvelocity); /* this multiplies
                                                                               * _spriteattitude by the given zRotation amount on the right. */
                }
                else
                {
                    first = false;
                }
            }
        }
Example #30
0
        public override bool collide(cCritter pcritter)
        {
            cCritter3DPlayer player = (cCritter3DPlayer)pcritter;

            if (contains(player)) //disk of pcritter is wholly inside my disk
            {
                Framework.snd.play(Sound.Clap);
                player.Health = cCritter3DPlayer.MAX_HEALTH;
                // one time use for the med pack
                delete_me();
                return(true);
            }
            else
            {
                return(false);
            }
        }