コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: AI.cs プロジェクト: NatalieWojciechowski/Space394
        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;
            }
        }
コード例 #3
0
 public AIRetreatState(AI _ai)
     : base(_ai)
 {
     currentState = state.Retreat;
     aiShip = ai.Ship;
     random = new Random(System.DateTime.Now.Millisecond + (int)aiShip.UniqueId);
     cardinal = getCardinalOffest();
 }
コード例 #4
0
        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();
        }
コード例 #5
0
        public EngineTrailParticleGenerator(Fighter _fighter, Vector3 _offset)
            : base()
        {
            fighter = _fighter;
            position = fighter.Position;
            lastPosition = position;

            offset = _offset;

            distance = 0;

            Initialize();
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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();
        }
コード例 #8
0
ファイル: AI.cs プロジェクト: NatalieWojciechowski/Space394
 public Fighter removePotentialFighter(Fighter _fighter)
 {
     potentialFighters.Remove(_fighter); return _fighter;
 }
コード例 #9
0
ファイル: AI.cs プロジェクト: NatalieWojciechowski/Space394
 public Fighter addPotentialFighter(Fighter _fighter)
 {
     potentialFighters.Add(_fighter); return _fighter;
 }
コード例 #10
0
        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
        }
コード例 #11
0
        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 { }
        }
コード例 #12
0
 public Fighter removeEsxolusFighter(Fighter ship)
 {
     esxolusFighters.Remove(ship); return ship;
 }
コード例 #13
0
 public Fighter addHalkFighter(Fighter ship)
 {
     halkFighters.Add(ship); return ship;
 }
コード例 #14
0
 public Fighter addFighterShip(Fighter ship)
 {
     if (ship.ShipTeam == Ship.Team.Esxolus)
     {
         return addEsxolusFighter(ship);
     }
     else
     {
         return addHalkFighter(ship);
     }
 }
コード例 #15
0
 public Fighter addEsxolusFighter(Fighter ship)
 {
     esxolusFighters.Add(ship); return ship;
 }
コード例 #16
0
        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 { }
        }
コード例 #17
0
 public Fighter removeFighterShip(Fighter ship)
 {
     if (ship.ShipTeam == Ship.Team.Esxolus)
     {
         return removeEsxolusFighter(ship);
     }
     else
     {
         return removeHalkFighter(ship);
     }
 }
コード例 #18
0
 public Fighter removeHalkFighter(Fighter ship)
 {
     halkFighters.Remove(ship); return ship;
 }
コード例 #19
0
 public EEngineTrailGenerator(Fighter _fighter, Vector3 _offset)
     : base(_fighter, _offset)
 {
 }
コード例 #20
0
        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;
        }