Example #1
0
File: Fish.cs Project: khoatle/game
        public void ReactToSwimmingObject(SwimmingObject swimmingObject, ref AIParameters AIparams)
        {
            if (swimmingObject != null)
            {
                //setting the the reactionLocation and reactionDistance here is
                //an optimization, many of the possible reactions use the distance
                //and location of theAnimal, so we might as well figure them out
                //only once !
                Vector3 otherLocation = swimmingObject.Position;
                ClosestLocation(ref location, ref otherLocation,
                    out reactionLocation);
                reactionDistance = Vector3.Distance(location, reactionLocation);

                //we only react if theAnimal is close enough that we can see it
                if (reactionDistance < AIparams.DetectionDistance)
                {
                    fleeReaction.Update(swimmingObject, AIparams);

                    if (fleeReaction.Reacted)
                    {
                        aiNewDir += fleeReaction.Reaction;
                        aiNumSeen++;
                    }

                }
            }
        }
Example #2
0
 public void Update(GameTime gameTime, BoundingFrustum frustum, HydroBot tank, SwimmingObject[] enemies, int enemyAmount, SwimmingObject[] fishes, int fishAmount)
 {
     if (flock != null)
     {
         flock.Update(gameTime, tank, frustum, enemies, enemyAmount, fishes, fishAmount);//, cat);
     }
     else
     {
         SpawnFlock(gameMaxX, gameMaxZ, minValueX, maxValueX, minValueZ, maxValueZ);
     }
 }
Example #3
0
 public virtual void Update(SwimmingObject swimmingObject, AIParameters aiParams)
 {
 }