public SpectatorPlayerState(Player _player) { player = _player; cameraPosition = nullPosition; cameraView = nullView; cameraUp = nullUp; index = 0; controls = new AutoTexture2D(ContentLoadManager.loadTexture("Textures/spectator_mode"), new Vector2(27, 433)); cameraPositionOffset = new Vector3(0, 15, -50); cameraLookAt = new Vector3(0, 0, 1000); // Find a team to start on Random random = new Random(System.DateTime.Now.Millisecond); if (random.Next() % 2 == 0) { currentTeam = Ship.Team.Esxolus; } else { currentTeam = Ship.Team.Halk; } follow = null; }
public AI(Fighter _ship) { ship = _ship; createPersonality(); random = new Random(System.DateTime.Now.Millisecond + (int)Ship.UniqueId); aiShared = new AI_Shared_Data(); aiShared.INTEREST_TIME = Ship.InterestTime + (float)random.NextDouble(); mySpawningState = new AISpawningState(this); myWaitingToSpawnState = new AIWaitingToSpawnState(this); myWanderState = new AIWanderState(this); myPursuitState = new AIPursuitState(this); myEngageBattleshipState = new AIEngageBattleshipState(this); myRetreatState = new AIRetreatState(this); myDyingState = new AIDyingState(this); potentialCapitals = new List<CapitalShip>(); potentialFighters = new List<Fighter>(); currentState = myWaitingToSpawnState; AI_Overmind.inWaitingToSpawn++; assignedPhase = nextAssignedPhase; switch (nextAssignedPhase) { case aiActivationPhase.first: nextAssignedPhase = aiActivationPhase.second; break; case aiActivationPhase.second: nextAssignedPhase = aiActivationPhase.third; break; case aiActivationPhase.third: nextAssignedPhase = aiActivationPhase.first; break; } }
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 DustParticleGenerator(Fighter _ship) : base() { ship = _ship; position = ship.Position; random = new Random((int)(System.DateTime.Now.Millisecond + position.X * 13 + position.Y * 7 + position.Z * 3)); visibleParticles = new CollisionSphere(ship.Position, VISIBLE_RANGE); Initialize(); }
public EngineTrailParticleGenerator(Fighter _fighter, Vector3 _offset) : base() { fighter = _fighter; position = fighter.Position; lastPosition = position; offset = _offset; distance = 0; Initialize(); }
public HEngineTrailGenerator(Fighter _fighter, Vector3 _offset) : base(_fighter, _offset) { PARTICLES = 15; MAX_DISTANCE = 85.0f; if (random == null) { initializeVecs(); } else { } // distance = (float)random.Next(1, 8); SPAWN_DISTANCE = 10.75f + (int)random.Next(0,5); }
public PilotingPlayerState(Player _player) { LogCat.updateValue("PlayerState", "Piloting"); player = _player; playerShip = _player.PlayerShip; playerShip.DustGenerator.Active = true; leavingSphere = new CollisionSphere(Vector3.Zero, LEAVING_RADIUS); InputManager.bindMouse(); player.PlayerHUDActive = true; bounceBackOffset = new Vector3(0, 15, -150); cameraPositionOffset = defaultOffset; cameraLookAt = defaultLookAt; setViewNoMove(); }
public Fighter removePotentialFighter(Fighter _fighter) { potentialFighters.Remove(_fighter); return _fighter; }
public Fighter addPotentialFighter(Fighter _fighter) { potentialFighters.Add(_fighter); return _fighter; }
public override void Update(float deltaTime) { if (Space394Game.GameInstance.CurrentScene is GameScene) { if (assignedPhase == currentPhase) { fireTimer -= deltaTime; if (target == null || target.Health <= 0 || !(Vector3.DistanceSquared(Position, target.Position) <= FIRE_RANGE_SQ)) { using (new ReadLock(GameScene.shipLock)) { List<Fighter> eShips = ((GameScene)Space394Game.GameInstance.CurrentScene).getEnemyFighters(team); foreach (Fighter enemy in eShips) { if (Vector3.DistanceSquared(Position, enemy.Position) <= FIRE_RANGE_SQ) { target = enemy; break; } else { } } } } else { Vector3 newForward = Vector3.Normalize(Position - (target.Position + (target.Velocity * deltaTime * AIM_MULTI))); // Quaternion desiredRotation = AdjustRotation(Vector3.Forward, newForward, Vector3.Up, deltaTime); Quaternion desiredRotation = AdjustRotationNoLimit(Vector3.Forward, newForward, Vector3.Up); if (Vector3.Dot(newForward, fireConeNormalVector) <= (1 - fireConeAngle)) { Rotation = desiredRotation; fire(); } else { } } } else { } base.Update(deltaTime); } else { } // Not game scene }
public override void ProcessInput() { if (InputManager.isCombinedPrimaryFirePressed(player.PlayerNumber)) { switch (currentTeam) { case Ship.Team.Esxolus: currentTeam = Ship.Team.Halk; break; case Ship.Team.Halk: currentTeam = Ship.Team.Esxolus; break; } follow = null; index = 0; } else { } if (InputManager.isCombinedLeftBumperPressed(player.PlayerNumber) || InputManager.isCombinedRightBumperPressed(player.PlayerNumber)) { follow = null; List<Fighter> fighters = null; switch (currentTeam) { case Ship.Team.Esxolus: fighters = ((GameScene)Space394Game.GameInstance.CurrentScene).EsxolusFighters; break; case Ship.Team.Halk: fighters = ((GameScene)Space394Game.GameInstance.CurrentScene).HalkFighters; break; } if (InputManager.isCombinedLeftBumperPressed(player.PlayerNumber)) { if (index < 0 || index >= fighters.Count) { index = fighters.Count - 1; follow = null; } else { } while (fighters != null && follow == null && fighters.Count > 0 && index >= 0) { if (fighters[index].Active) { follow = fighters[index]; } else { } index--; } if (index < 0 || index >= fighters.Count) { index = fighters.Count-1; follow = null; } else { } } else if (InputManager.isCombinedRightBumperPressed(player.PlayerNumber)) { if (index < 0 || index >= fighters.Count) { index = fighters.Count - 1; follow = null; } else { } while (fighters != null && follow == null && fighters.Count > 0 && index < fighters.Count) { if (fighters[index].Active) { follow = fighters[index]; } else { } index++; } if (index < 0 || index >= fighters.Count) { index = 0; follow = null; } else { } } else { } } else { } if (InputManager.isCombinedToggleObjectivesPressed(player.PlayerNumber)) { player.ObjectivesDrawActive = !player.ObjectivesDrawActive; } else { } if (InputManager.isCombinedPausePressed(player.PlayerNumber)) { player.pause(); } else { } }
public Fighter removeEsxolusFighter(Fighter ship) { esxolusFighters.Remove(ship); return ship; }
public Fighter addHalkFighter(Fighter ship) { halkFighters.Add(ship); return ship; }
public Fighter addFighterShip(Fighter ship) { if (ship.ShipTeam == Ship.Team.Esxolus) { return addEsxolusFighter(ship); } else { return addHalkFighter(ship); } }
public Fighter addEsxolusFighter(Fighter ship) { esxolusFighters.Add(ship); return ship; }
public override void Update(float deltaTime) { if (follow != null) { if (!follow.Active) { follow = null; List<Fighter> fighters = null; switch (currentTeam) { case Ship.Team.Esxolus: fighters = ((GameScene)Space394Game.GameInstance.CurrentScene).EsxolusFighters; break; case Ship.Team.Halk: fighters = ((GameScene)Space394Game.GameInstance.CurrentScene).HalkFighters; break; } while (fighters != null && follow == null && index < fighters.Count) { if (fighters[index].Active) { follow = fighters[index]; } else { } index++; } } else { Vector3 position = Vector3.Transform(cameraPositionOffset, follow.PreviousRotation) + follow.PreviousPosition; Vector3 target = Vector3.Transform(cameraLookAt, follow.PreviousRotation) + follow.PreviousPosition; Vector3 up = Vector3.Transform(Vector3.Up, follow.PreviousRotation); player.PlayerCamera.setViewMatrix(position, target, up); #if DEBUG LogCat.updateValue("Ship's State", "" + follow.MyAI.CurrentState.CurrentState); #endif } } else { } }
public Fighter removeFighterShip(Fighter ship) { if (ship.ShipTeam == Ship.Team.Esxolus) { return removeEsxolusFighter(ship); } else { return removeHalkFighter(ship); } }
public Fighter removeHalkFighter(Fighter ship) { halkFighters.Remove(ship); return ship; }
public EEngineTrailGenerator(Fighter _fighter, Vector3 _offset) : base(_fighter, _offset) { }
public Vector3 playerInit(Vector3 _offset, Player _player) { if (_player.PlayerShip != null) { Position = _player.PlayerShip.Position + _offset; Target = _player.PlayerShip.Position; playerShip = _player.PlayerShip; } else { Position = Vector3.Zero + _offset; Target = Vector3.Zero; playerShip = null; } return Position; }