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++; } } } }
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); } }
public virtual void Update(SwimmingObject swimmingObject, AIParameters aiParams) { }