コード例 #1
0
ファイル: SpawnController.cs プロジェクト: jwmcglynn/TeamQ
        public SpawnController(GameEnvironment env, IList<Squared.Tiled.ObjectGroup> objectGroupList)
        {
            Environment = env;

            bool spawnedPlayer = false;

            // Load spawn points.
            foreach (Squared.Tiled.ObjectGroup objGroup in objectGroupList) {
                foreach (List<Squared.Tiled.Object> objList in objGroup.Objects.Values) {
                    foreach (Squared.Tiled.Object obj in objList) {
                        if (obj.Type == "possibleBlackhole") {
                            obj.Type = "blackhole";
                            Environment.PossibleBlackHoleLocations.Add(new SpawnPoint(this, obj));
                            continue;
                        } else if (obj.Type == "BossPatrolPoint") {
                            Environment.SpawnedBossPatrolPoints.Add(new Vector2(obj.X, obj.Y) + new Vector2(obj.Width, obj.Height) / 2);
                            continue;
                        }

                        SpawnPoint sp = new SpawnPoint(this, obj);
                        if (sp.Entity == null) SpawnPoints.Add(sp);

                        if (sp.EntityType == "blackhole") Environment.SpawnedBlackHoles.Add(sp);
                        else if (sp.EntityType == "spawn") spawnedPlayer = true;
                    }
                }
            }

            if (!spawnedPlayer) throw new InvalidOperationException("Level loaded does not contain player spawn point.");
        }
コード例 #2
0
ファイル: CircloidShip.cs プロジェクト: jwmcglynn/TeamQ
 public CircloidShip(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
     Position = sp.Position;
     Initialize(sp); // FIXME: Find a better way to get positions.
     env.circles.Add(this);
 }
コード例 #3
0
ファイル: SquaretopiaShip.cs プロジェクト: jwmcglynn/TeamQ
 public SquaretopiaShip(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
     Position = sp.Position;
     Initialize(sp);
     env.squares.Add(this);
 }
コード例 #4
0
ファイル: BlackHole.cs プロジェクト: jwmcglynn/TeamQ
 public BlackHole(GameEnvironment e, SpawnPoint sp)
     : base(e, sp)
 {
     Position = sp.Position;
     initialize();
     Environment.blackHoles.Add(this);
     // Find where wormhole points.
     wormHole = Environment.SpawnedBlackHoles.Find(spawn => spawn.Name == SpawnPoint.Name && spawn != SpawnPoint);
 }
コード例 #5
0
ファイル: Asteroid.cs プロジェクト: jwmcglynn/TeamQ
        public Asteroid(GameEnvironment env, SpawnPoint sp)
            : base(env, sp)
        {
            Position = sp.Position;

            LoadTexture(Environment.contentManager, "astroid_1");
            Registration = new Vector2(Texture.Width, Texture.Height) * 0.5f;
            Zindex = 0.4f;

            CreateAsteroidCollision(true);
        }
コード例 #6
0
ファイル: BlackHole.cs プロジェクト: jwmcglynn/TeamQ
        public static Pair CreatePair(GameEnvironment env, Vector2 pos)
        {
            SpawnPoint sp = new SpawnPoint(env.SpawnController, "blackhole", pos);
            sp.Properties.Add("justCreated", "true");
            env.SpawnedBlackHoles.Add(sp);
            sp.Name = "__blackhole_" + s_uniqueId;
            ++s_uniqueId;

            // Create wormhole.
            Random rand = new Random();
            List<SpawnPoint> locs = env.PossibleBlackHoleLocations.FindAll(x => !x.Properties.ContainsKey("active"));

            SpawnPoint wormHole = locs[rand.Next(0, locs.Count)];
            wormHole.Properties.Add("active", "true");
            wormHole.Properties.Add("justCreated", "true");
            wormHole.Name = sp.Name;
            env.SpawnedBlackHoles.Add(wormHole);
            env.SpawnController.SpawnPoints.Add(wormHole);

            sp.Spawn();
            return new Pair(env, sp, wormHole);
        }
コード例 #7
0
ファイル: AIController.cs プロジェクト: jwmcglynn/TeamQ
        private float waitTimer; //countdown timer for ships to stay inert while neutral

        #endregion Fields

        #region Constructors

        /// <summary>
        ///  Creates a new AI with given spawnpoint and given environment
        ///  Initial state is Neutral
        /// </summary>
        public AIController(SpawnPoint sp, GameEnvironment e)
        {
            timeSinceLastStateChange = 0;
            spawn = sp;
            env = e;
            nextState = State.Neutral;
            currentState = State.Neutral;
            target = null;
            answeringDistressCall = false;
            lookingFor = null;
            currentShip = null;
            timeSinceHitWall = 0; ;
            timeSinceChangedTargets = 0;
            waitTimer = 0;
            patrolPoints = new List<Vector2>();
            patrolPoints.Add(randomPatrolPoint());
            oldTarget = null;
            timeSinceMoved = 0;
            oldPosition = new Vector2(-1000, 1000);//I hope this is improbable
            timeSinceSawTarget = 0;
            timeSinceAnsweredDistressCall = 0;
            targetList = new List<GameEntity>();
        }
コード例 #8
0
ファイル: SquaretopiaShip.cs プロジェクト: jwmcglynn/TeamQ
 public SquaretopiaShip(GameEnvironment env, Vector2 pos, SpawnPoint sp)
     : base(env, pos)
 {
     Initialize(sp);
     env.squares.Add(this);
 }
コード例 #9
0
ファイル: SquaretopiaShip.cs プロジェクト: jwmcglynn/TeamQ
        private void Initialize(SpawnPoint sp)
        {
            shooter = new BulletEmitter(Environment, this,BulletEmitter.BulletStrength.Strong);
            AddChild(shooter);
            RelativeShooterPos = new Vector2(50.0f, 0.0f);

            ai = m_originalAI = new AIController(sp, Environment);
            LoadTexture(Environment.contentManager, "squaretopia");

            Registration = new Vector2(100.0f, 125.0f);
            CreateCollisionBody(Environment.CollisionWorld, BodyType.Dynamic, CollisionFlags.Default);
            AddCollisionCircle(50.0f, Vector2.Zero);
            CollisionBody.LinearDamping = 8.0f;
            this.health = this.MaxHealth = (int)(this.MaxHealth * 1.5);
            passiveShield = 20.0f;

            shield = new Entity();
            shield.Zindex = 0.0f;
            shield.Registration = new Vector2(125.0f, 115.0f);
            shield.LoadTexture(Environment.contentManager, "shield");
            shield.Position = Position;
            shield.Alpha = 0.0f;
            AddChild(shield);
        }
コード例 #10
0
 public EnvironmentalForceField(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
     Position = sp.Position;
     initialize();
 }
コード例 #11
0
ファイル: BlackHole.cs プロジェクト: jwmcglynn/TeamQ
 public SpawnPoint Other(SpawnPoint current)
 {
     if (current == First) return Second;
     else return First;
 }
コード例 #12
0
ファイル: BlackHole.cs プロジェクト: jwmcglynn/TeamQ
 internal Pair(GameEnvironment _env, SpawnPoint _first, SpawnPoint _second)
 {
     Environment = _env;
     First = _first;
     Second = _second;
 }
コード例 #13
0
ファイル: GameEntity.cs プロジェクト: jwmcglynn/TeamQ
 /// <summary>
 /// Called immediately before Entity is culled this and update the SpawnPoint before an object is culled.
 /// </summary>
 public virtual void OnCull()
 {
     // Currently does nothing.  Update SpawnPoint.
     SpawnPoint.Reset();
     SpawnPoint = null;
 }
コード例 #14
0
ファイル: GameEntity.cs プロジェクト: jwmcglynn/TeamQ
 public GameEntity(GameEnvironment env, SpawnPoint sp)
 {
     Environment = env;
     SpawnPoint = sp;
 }
コード例 #15
0
ファイル: CircloidShip.cs プロジェクト: jwmcglynn/TeamQ
        private void Initialize(SpawnPoint sp)
        {
            shooter = new BulletEmitter(Environment, this, BulletEmitter.BulletStrength.Medium);
            AddChild(shooter);
            RelativeShooterPos = new Vector2(65.0f, -5.0f);

            ai = m_originalAI = new AIController(sp, Environment);
            LoadTexture(Environment.contentManager, "circloid");

            Registration = new Vector2(117.0f, 101.0f);
            CreateCollisionBody(Environment.CollisionWorld, BodyType.Dynamic, CollisionFlags.Default);
            AddCollisionCircle(60.0f, Vector2.Zero);
            CollisionBody.LinearDamping = 8.0f;
            CollisionBody.IgnoreGravity = true; // The circloid will not be affected by its own black hole.
            this.maxSpeed *= 1.25f;
            this.health = this.MaxHealth = (int)(this.MaxHealth * 1.25);
        }
コード例 #16
0
ファイル: Ship.cs プロジェクト: jwmcglynn/TeamQ
 public Ship(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
     Initialize();
     SpawnPoint.RespawnCooldown = 0.0f;
 }
コード例 #17
0
ファイル: CircloidShip.cs プロジェクト: jwmcglynn/TeamQ
 public CircloidShip(GameEnvironment env, Vector2 pos, SpawnPoint sp)
     : base(env, pos)
 {
     Initialize(sp);
     env.circles.Add(this);
 }
コード例 #18
0
ファイル: Boss.cs プロジェクト: jwmcglynn/TeamQ
 public Boss(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
     initialize();
     Position = sp.Position;
 }
コード例 #19
0
ファイル: SaphereBoss.cs プロジェクト: jwmcglynn/TeamQ
 public SaphereBoss(GameEnvironment env, SpawnPoint sp)
     : base(env, sp)
 {
 }