public AIWanderState(AI _ai, float _timer)
     : this(_ai)
 {
     currentState = state.Wandering;
     random = new Random(System.DateTime.Now.Millisecond + (int)ai.Ship.UniqueId);
     rotationUpdateTimer = _timer;
 }
        public AIPilotingState(AI _ai)
            : base(_ai)
        {
            StateComplete = false;

            random = new Random(System.DateTime.Now.Millisecond + (int)ai.Ship.UniqueId);

            targetCheckTimer = TARGET_CHECK_TIMER + (float)(random.Next(1,3) * random.NextDouble());

            targetSphere = new CollisionSphere(ai.Ship.Position, TARGET_SPHERE_SIZE);
            targetSphere.Active = true;

            boostSphere = new CollisionSphere(ai.Ship.Position, BOOST_SPHERE_SIZE);
            brakeSphere = new CollisionSphere(ai.Ship.Position, BRAKE_SPHERE_SIZE);

            pursuitRetreatSphere = new CollisionSphere(ai.Ship.Position, P_RETREAT_SPHERE_SIZE);
            engageRetreatSphere = new CollisionSphere(ai.Ship.Position, E_RETREAT_SPHERE_SIZE);

            FIRE_RATE = ai.Ship.FireRate;
            SPECIAL_RATE = ai.Ship.SpecialRate;

            speedUpdateTimer = SPEED_UPDATE_RATE;
            retreatUpdateTimer = RETREAT_UPDATE_RATE;

            ai.aiShared.INTEREST_TIME = ai.Ship.InterestTime + (float)random.NextDouble();
            ai.aiShared.interestTimer = ai.aiShared.INTEREST_TIME;
            ai.aiShared.fleeCounter = 0;
        }
 public AIPursuitState(AI _ai)
     : base(_ai)
 {
     currentState = state.Pursuit;
     random = new Random(System.DateTime.Now.Millisecond + (int)ai.Ship.UniqueId);
     // recycleState(null);
 }
 public AIWaitingToSpawnState(AI _ai)
     : base(_ai)
 {
     currentState = state.WaitingToSpawn;
     StateComplete = false;
     //            recycleState();
 }
 public AIRetreatState(AI _ai)
     : base(_ai)
 {
     currentState = state.Retreat;
     aiShip = ai.Ship;
     random = new Random(System.DateTime.Now.Millisecond + (int)aiShip.UniqueId);
     cardinal = getCardinalOffest();
 }
 public override AIState getNextState(AI _ai)
 {
     AI.AI_Overmind.inDying--;
     return (nextState);
 }
 public AIWanderState(AI _ai)
     : base(_ai)
 {
     currentState = state.Wandering;
     random = new Random(System.DateTime.Now.Millisecond + (int)ai.Ship.UniqueId);
 }
 public override AIState getNextState(AI _ai)
 {
     haveLists = false; // get a new list when re-entering in case it has changed
     AI.AI_Overmind.inWander--;
     return (nextState); // Already recycled
 }
 public void removeAI(AI ai)
 {
     lock (aiList) { aiList.Remove(ai); }
 }
 public void addAI(AI ai)
 {
     lock (aiList) { aiList.Add(ai); }
 }
Example #11
0
        private float zSpeed = 20.0f; // The speed the ship is moving at

        #endregion Fields

        #region Constructors

        public Fighter(long _uniqueId, Vector3 _position, Quaternion _rotation, Team _team, SpawnShip _home)
            : base(_uniqueId, _position, _rotation, _team)
        {
            myAI = new AI(this);

            SHIELD_RECOVER_RATE /= 5;

            Damage = 0.5f;

            MAX_HEALTH = 5;
            Health = MaxHealth;

            MAX_SHIELDS = 5;
            Shields = MaxShields;

            PRIMARY_RANGE   = 1000000f;
            SECONDARY_RANGE = 800000f;

            INTEREST_TIME = 20;
            interestTimer = INTEREST_TIME;

            maxJitterPosition = new Vector3(0.5f, 0.5f, 0.5f);
            minJitterPosition = -maxJitterPosition;

            maxJitterRotation = Quaternion.Identity;
            minJitterRotation = maxJitterRotation;

            maxJitterPositionVelocity = new Vector3(0.5f, 0.5f, 0.5f);
            minJitterPositionVelocity = -maxJitterPositionVelocity;

            maxJitterRotationVelocity = Quaternion.Identity;
            minJitterRotationVelocity = maxJitterRotationVelocity;

            home = _home;

            random = new Random((int)_uniqueId);

            dustGenerator = new DustParticleGenerator(this);
            trailGenerators = new List<EngineTrailParticleGenerator>();
            Active = false;
        }
 public override AIState getNextState(AI _ai)
 {
     AI.AI_Overmind.inSpawning--;
     return nextState;
 }
 public AIEngageBattleshipState(AI _ai)
     : base(_ai)
 {
     currentState = state.EngageBattleship;
     random = new Random(System.DateTime.Now.Millisecond + (int)ai.Ship.UniqueId);
 }
Example #14
0
 public AIState(AI _ai)
 {
     stateComplete = false;
     ai = _ai;
 }
 public override AIState getNextState(AI _ai)
 {
     AI.AI_Overmind.inPursuit--;
     return (nextState); // Already recycled
 }
 public AIPursuitState(AI _ai, Ship _target, int _fleeCounter)
     : this(_ai)
 {
     // recycleState(_target, fleeCounter, ai.getShip().getInterestTime());
 }
 public override AIState getNextState(AI _ai)
 {
     AI.AI_Overmind.inWaitingToSpawn--;
     return (nextState);
 }
 public override AIState getNextState(AI _ai)
 {
     AI.AI_Overmind.inEngageBattleship--;
     return (nextState); // Already recycled
 }
Example #19
0
 public abstract AIState getNextState(AI _ai);
 public AISpawningState(AI _ai)
     : base(_ai)
 {
     currentState = state.Spawning;
     StateComplete = false;
 }