///<summary> ///constructor for the NavigationalMemoryRecord class ///</summary> public NavigationalMemoryRecord( BotEntity owner, NavigationalMemory.NavigationalMemoryKey key) { Mode = key.Mode; SourceNodeIndex = key.SourceNodeIndex; DestinationNodeIndex = key.DestinationNodeIndex; Vector2 position = owner.PathPlanner.GetNodePosition(key.DestinationNodeIndex); RunningAverageTimeTaken = Vector2.Distance(owner.Position, position)/ owner.MaxSpeed*3.0f; //200% margin //TODO: make parameter //switch (key.Mode) //{ // case NavigationalMemory.TravelModes.FollowPath: // break; // case NavigationalMemory.TravelModes.SeekToPosition: // break; // case NavigationalMemory.TravelModes.TraverseEdge: // break; //} }
///<summary> ///constructor ///</summary> ///<param name="entitySceneObject"></param> ///<param name="pos"></param> public BotEntity(IEntitySceneObject entitySceneObject, Vector2 pos) : base(entitySceneObject, pos, GameManager.GameManager.Instance.Parameters.BotScale, Vector2.Zero, GameManager.GameManager.Instance.Parameters.BotMaxSpeed, Vector2.One, // initial heading GameManager.GameManager.Instance.Parameters.BotMass, Vector2.Normalize(Vector2.One)* GameManager.GameManager.Instance.Parameters.BotScale, GameManager.GameManager.Instance.Parameters.BotMaxHeadTurnRate, GameManager.GameManager.Instance.Parameters.BotMaxForce) { _maxHealth = GameManager.GameManager.Instance.Parameters.BotMaxHealth; CurrentHealth = 10; _pathPlanner = null; _steering = null; _brain = null; NumUpdatesHitPersistent = (int) GameManager.GameManager.Instance.Parameters.HitFlashTime; Hit = false; Score = 0; _status = Statuses.Spawning; IsPossessed = false; _fieldOfView = MathHelper.ToRadians(GameManager.GameManager.Instance.Parameters.BotFOV); _maxNormalSpeed = GameManager.GameManager.Instance.Parameters.BotMaxSpeed; _maxSwimmingSpeed = GameManager.GameManager.Instance.Parameters.BotMaxSwimmingSpeed; _maxCrawlingSpeed = GameManager.GameManager.Instance.Parameters.BotMaxCrawlingSpeed; EntityType = EntityTypes.Bot; //a bot starts off facing in the direction it is heading Facing = Heading; //create the navigation module _pathPlanner = new PathPlanner(this); //create the steering behavior class _steering = new Steering.Steering(this); //create the regulators _weaponSelectionRegulator = new Regulator( GameManager.GameManager.Instance.Parameters.BotWeaponSelectionFrequency); _goalArbitrationRegulator = new Regulator( GameManager.GameManager.Instance.Parameters.BotGoalAppraisalUpdateFreq); _targetSelectionRegulator = new Regulator( GameManager.GameManager.Instance.Parameters.BotTargetingUpdateFreq); _triggerTestRegulator = new Regulator( GameManager.GameManager.Instance.Parameters.BotTriggerUpdateFreq); _visionUpdateRegulator = new Regulator( GameManager.GameManager.Instance.Parameters.BotVisionUpdateFreq); //create the goal queue _brain = new Think(this); //create the targeting system _targetingSystem = new TargetingSystem(this); _weaponSystem = new WeaponSystem(this, GameManager.GameManager.Instance.Parameters.BotReactionTime, GameManager.GameManager.Instance.Parameters.BotAimAccuracy, GameManager.GameManager.Instance.Parameters.BotAimPersistence); _sensoryMemory = new SensoryMemory( this, GameManager.GameManager.Instance.Parameters.BotMemorySpan); _navigationalMemory = new NavigationalMemory(this, GameManager.GameManager.Instance.Parameters.NavigationMemorySpan); //temp debbugging code _navigationalMemory.DumpFrequency = 10000; // 10 seconds FoundTriggers = new FoundTriggerList(Team); _logPrefixText = String.Format("[{0,-8}] [{1,17}.", Name, "BotEntity"); }