Exemplo n.º 1
0
        public EnemySquadron(List<Collidable> collidableListRef, CollidableType type, float boundingRadius, BasicModel enemyModel, List<Enemy> enemyList, List<EnemyFrigate> enemyFrigateList, WeaponSystem2D enemyWeaponSystem, Vector3 basePosition, int defaultLife, int amtShips, int shipsArsenal)
        {
            CollidableReference = collidableListRef;
            EnemyList = enemyList;
            _basePosition = basePosition;
            _enemyModel = enemyModel;
            _enemyWeaponSystem = enemyWeaponSystem;

            _type = type;
            _boundingRadius = boundingRadius;

            _randomVar = new Random();

            _enemyTemplate = new Enemy(EnemyList[0].CollidableType, EnemyList[0].BoundingSphereRadius, EnemyList[0].ShipPosition, EnemyList[0].ShipRotation, EnemyList[0].MinShipSpeed,
                EnemyList[0].MaxShipSpeed, EnemyList[0].TurningSpeed, EnemyList[0].DistanceThresholdFriend, EnemyList[0].DistanceThresholdEnemy, EnemyList[0].Life);

            _defaultLife = defaultLife;

            _amountShips = amtShips;

            ShipsArsenal = shipsArsenal;

            EnemyList.AddRange(enemyFrigateList);

            CollidableReference.AddRange(EnemyList);
        }
Exemplo n.º 2
0
        public EnemyFrigate(BasicModel model, CollidableType type, float boundingRadius, Vector3 shipPosition, Quaternion shipRotation, float minShipSpeed, float maxShipSpeed,
            float turningSpeed, float distanceThresholdEnemy, float distanceThresholdFriend, int life, List<WeaponSystem2D> weaponSystemList)
        {
            ShipPosition = shipPosition;
            ShipWorld = Matrix.CreateTranslation(shipPosition);
            ShipRotation = shipRotation;

            ShipSpeed = 1f;
            MinShipSpeed = minShipSpeed;
            MaxShipSpeed = maxShipSpeed;
            TurningSpeed = turningSpeed;

            DistanceThresholdEnemy = distanceThresholdEnemy;
            DistanceThresholdFriend = distanceThresholdFriend;

            this.CollidableType = type;
            this.BoundingSphereRadius = boundingRadius;
            IsFrigate = true;
            Life = life;

            _model = model;
            _momentum = 0f;
            _shipStopped = true;

            _weaponsList = weaponSystemList;

            _randomVar = new Random();
        }
Exemplo n.º 3
0
        public FriendSquadron(List<Collidable> collidableList, CollidableType type, float boundingRadius, BasicModel friendModel, List<Friend> friendList, WeaponSystem2D weaponSystem, Vector3 basePosition, int defaultLife, int amtShips, int shipsArsenal)
        {
            CollidableReference = collidableList;
            FriendList = friendList;
            CollidableReference.AddRange(FriendList);
            _basePosition = basePosition;
            _friendModel = friendModel;
            _weaponSystem = weaponSystem;

            _type = type;
            _boundingRadius = boundingRadius;

            _randomVar = new Random();

            //Copies the first friend into a template, so a friend could be easily generated.
            _friendTemplate = new Friend(friendList[0].CollidableType, friendList[0].BoundingSphereRadius, friendList[0].ShipPosition, friendList[0].ShipRotation, friendList[0].MinShipSpeed,
                friendList[0].MaxShipSpeed, friendList[0].Acceleration, friendList[0].TurningSpeed, friendList[0].DistanceThresholdFriend, friendList[0].DistanceThresholdEnemy, friendList[0].Life);

            _defaultLife = defaultLife;

            _amountShips = amtShips;

            _soundDump = new List<Sound>();

            ShipsArsenal = shipsArsenal;
        }
Exemplo n.º 4
0
 public MissleSystem2D(List<Collidable> collidableList, CollidableType type, float radius, SoundType soundType, Texture2D weaponTexture, float scale, GraphicsDevice device, int maxBullets,
     Vector3 weaponPositionRelative, float coolDownMS, float weaponSpeed, float bulletSpreadIntensity, int amountMissles, int life)
     : base(collidableList, type, radius, soundType, weaponTexture, scale, device, maxBullets, weaponPositionRelative, coolDownMS, weaponSpeed, bulletSpreadIntensity)
 {
     AmountMissles = amountMissles;
     _life = life;
 }
Exemplo n.º 5
0
 public CollidableSphere(CollidableType collidableType_0, string string_0, Vector2 vector2_0, int int_0)
 {
     Class13.lOBHd9Nzn7x2T();
     base..ctor(collidableType_0, 0, string_0);
     this.Center = vector2_0;
     this.Radius = int_0;
 }
Exemplo n.º 6
0
        public WeaponSystem2D(List<Collidable> collidableRef, CollidableType type, float radius, SoundType soundType, Texture2D weaponTexture, float scale, GraphicsDevice device, int maxBullets,  Vector3 weaponPositionRelative, float coolDownMS, float weaponSpeed, float bulletSpreadIntensity)
        {
            CollidableReference = collidableRef;
            _projectileList = new List<Projectile>();
            _weaponPositionRelative = weaponPositionRelative;
            _coolDownMS = coolDownMS;
            _weaponSpeed = weaponSpeed;
            _timer = 0;
            _randomVar = new Random();
            _device = device;
            _textureQuad = new TextureQuad(_device, weaponTexture, scale, scale);

            _weaponTexture = weaponTexture;
            _scale = scale;

            _spriteBatch = new SpriteBatch(_device);
            _basicEffect = new BasicEffect(_device);

            _bulletSpreadIntensity = bulletSpreadIntensity;

            _maxBullets = maxBullets;

            _type = type;
            _boundingRadius = radius;

            _soundDump = new List<Sound>();
            _soundType = soundType;
        }
Exemplo n.º 7
0
 public CollidableSphere(CollidableType collidableType_0, string string_0, Vector2 vector2_0, int int_0)
 {
     Class13.NP5bWyNzLwONS();
     base..ctor(collidableType_0, 0, string_0);
     this.Center = vector2_0;
     this.Radius = int_0;
 }
Exemplo n.º 8
0
 protected override bool ShouldIgnoreCollision(CollidableType collidableType)
 {
     if (collidableType == CollidableType.Asteroid || collidableType == CollidableType.Powerup)
     {
         return(true);
     }
     return(false);
 }
Exemplo n.º 9
0
 public Collidable(CollidableType collidableType_0, int int_0, string string_0)
 {
     Class13.NP5bWyNzLwONS();
     base..ctor();
     this.Type  = collidableType_0;
     this.Shape = int_0;
     this.Name  = string_0;
 }
Exemplo n.º 10
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.FriendlyShip:
             break;
     }
 }
Exemplo n.º 11
0
 public Collidable(CollidableType collidableType_0, int int_0, string string_0)
 {
     Class13.lOBHd9Nzn7x2T();
     base..ctor();
     this.Type  = collidableType_0;
     this.Shape = int_0;
     this.Name  = string_0;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CollidableSprite"/> class.
 /// </summary>
 /// <param name="info">The sprite information.</param>
 public CollidableSprite(SpriteInfo info, CollidableType collidableType)
     : base(info)
 {
     this._collidableType = collidableType;
     if (CollisionManager.Collection != null)
     {
         CollisionManager.Collection.Insert(this);
     }
 }
Exemplo n.º 13
0
 public Starbase(CollidableType type, float radius, Model starBaseModel, Vector3 position, Quaternion rotation, float scale)
 {
     this.CollidableType = type;
     this.BoundingSphereRadius = radius;
     _baseModel = new BasicModel(starBaseModel, scale);
     _rotation = rotation;
     _scale = scale;
     Position = position;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Box" /> class.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <param name="collidableType">The collidable type of the sprite.</param>
 /// <param name="texture">The texture (default = null).</param>
 /// <param name="scale">The scale (default = 1).</param>
 /// <param name="width">The width.</param>
 /// <param name="height">The height.</param>
 public CollidableSprite(IServiceProvider site, Vector2 position, CollidableType?collidableType = CollidableType.Passable, Texture2D texture = null, float scale = 1.0f)
     : base(site, position, texture, null, Color.White, 0.0f, Vector2.Zero, scale)
 {
     this._collidableType = collidableType.HasValue ? collidableType.Value : CollidableType.Passable;
     if (CollisionManager.Collection != null)
     {
         CollisionManager.Collection.Insert(this);
     }
 }
Exemplo n.º 15
0
 public Projectile(CollidableType type, float boundingRadius, Vector3 position, Quaternion rotation, float bulletSpeed, int life = 0)
 {
     Position = position;
     Rotation = rotation;
     _bulletSpeed = bulletSpeed;
     this.BoundingSphereRadius = boundingRadius;
     this.CollidableType = type;
     ClosestEnemyPos = null;
     Life = life;
 }
Exemplo n.º 16
0
Arquivo: Dock.cs Projeto: robertg/Soar
        public Dock(CollidableType type, float radius, BasicModel model, Vector3 pos, Quaternion rotation)
        {
            this.CollidableType = type;
            this.BoundingSphereRadius = radius;
            this.BoundingSphereCenter = pos;

            _model = model;
            _position = pos;
            _model.UpdateModel(Matrix.CreateTranslation(_position) * Matrix.CreateFromQuaternion(rotation));
        }
Exemplo n.º 17
0
        public Asteroid(CollidableType type, float boundingRadius, AsteroidType asteroidType, Vector3 position, float rotationSpeed)
        {
            Position = position;
            AsteroidType = asteroidType;
            Rotation = Quaternion.Identity;
            _rotationSpeed = rotationSpeed;
            World = Matrix.CreateTranslation(position);

            this.CollidableType = type;
            this.BoundingSphereRadius = boundingRadius;
        }
Exemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollidableSprite"/> class.
        /// </summary>
        /// <param name="info">The sprite information.</param>
        public CollidableSprite(SpriteInfo info)
            : base(info)
        {
            var setting = info.Settings.FirstOrDefault(s => s.Key.Equals("CollidableType", StringComparison.OrdinalIgnoreCase));

            if ((setting == null) || !Enum.TryParse(setting.Value, out this._collidableType))
            {
                this._collidableType = CollidableType.Passable;
            }

            if (CollisionManager.Collection != null)
            {
                CollisionManager.Collection.Insert(this);
            }
        }
Exemplo n.º 19
0
        public PlayerShip(List<Collidable> collidableRef, CollidableType type, float boundingRadius, Model model, Vector3 shipPosition, GraphicsDevice device, Vector3 cameraFollowPosition, float scale, float minShipSpeed, float maxShipSpeed, float acceleration, float turningSpeed,
            float maxTurningSpeed, float minTurningSpeed, WeaponSystem2D weaponSystem2D, MissleSystem2D missleSystem2D, SpawnerManager spawnerManager, PlayerConfig[] playerConfigurations)
        {
            CollidableReference = collidableRef;

            _shipModel = new BasicModel(model, scale);

            ShipWorld = Matrix.CreateTranslation(shipPosition) * Matrix.CreateScale(scale);
            _dockingPosition = shipPosition;
            ShipPosition = shipPosition;

            _shipRotation = Quaternion.Identity;

            Camera = new Camera(device, cameraFollowPosition);

            _keyboard = new KeyboardInput();

            _minShipSpeed = minShipSpeed;
            _maxShipSpeed = maxShipSpeed;
            _acceleration = acceleration;
            _turningSpeed = turningSpeed;
            _gamePadInput = new GamePadInput();

            _weaponSystem2D = weaponSystem2D;
            _device = device;
            _shipRotation.Normalize();

            //Collidable Properties
            this.CollidableType = type;
            this.BoundingSphereRadius = boundingRadius;

            _maxTurningSpeed = maxTurningSpeed;
            _minTurningSpeed = minTurningSpeed;

            Life = 0;

            _soundDump = new List<Sound>();

            spawnerManager.Selected += (object sender, EventArgs args) =>
                {
                    SpawnerManager SM = sender as SpawnerManager;
                    Spawn(SM._selected);
                };

            _missleSystem2D = missleSystem2D;

            _playerConfigurations = playerConfigurations;
        }
Exemplo n.º 20
0
        public Friend(CollidableType type, float boundingRadius, Vector3 shipPosition, Quaternion shipRotation, float minShipSpeed, float maxShipSpeed, float acceleration, float turningSpeed, float distanceThresholdFriend, float distanceThresholdEnemy, int life)
        {
            ShipPosition = shipPosition;
            ShipWorld = Matrix.CreateTranslation(shipPosition);
            ShipRotation = shipRotation;

            ShipSpeed = 0;
            MinShipSpeed = minShipSpeed;
            MaxShipSpeed = maxShipSpeed;
            Acceleration = acceleration;
            TurningSpeed = turningSpeed;

            DistanceThresholdFriend = distanceThresholdFriend;
            DistanceThresholdEnemy = distanceThresholdEnemy;

            this.CollidableType = type;
            this.BoundingSphereRadius = boundingRadius;
            Life = life;

            _randomVar = new Random();
        }
Exemplo n.º 21
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.PlayerBullet:
             Life--;
             break;
         case CollidableType.FriendBullet:
             Life--;
             break;
         case CollidableType.FriendlyShip:
             Life = 0;
             break;
         case CollidableType.Station:
             Life--;
             break;
         case CollidableType.Asteroid:
             Life--;
             break;
     }
 }
Exemplo n.º 22
0
 public virtual void Collision(CollidableType objCollided)
 {
 }
Exemplo n.º 23
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.EnemyBullet:
             if(this.CollidableType != CollidableType.EnemyBullet)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.EnemyBase:
             if (this.CollidableType != CollidableType.EnemyBullet)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.FriendBase:
             if (this.CollidableType != CollidableType.FriendBullet)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.FriendlyShip:
             if (this.CollidableType != CollidableType.FriendBullet
                 && this.CollidableType != CollidableType.FriendMissle)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.FriendBullet:
             if (this.CollidableType != CollidableType.FriendBullet
                 && this.CollidableType != CollidableType.FriendMissle)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.EnemyShip:
             if (this.CollidableType != CollidableType.EnemyBullet)
             {
                 Destroyed = true;
             }
             break;
         case CollidableType.Station:
             Destroyed = true;
             break;
         case CollidableType.Asteroid:
             Destroyed = true;
             break;
     }
 }
Exemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Barrier"/> class.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <param name="collidableType">Type of the collidable.</param>
 /// <param name="shape">The shape.</param>
 /// <param name="color">The color.</param>
 public Barrier(IServiceProvider site, Vector2 position, CollidableType collidableType, Rectangle shape, Color color)
     : base(site, position, collidableType)
 {
     this.SourceRectangle = shape;
     this._color          = color;
 }
Exemplo n.º 25
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.PlayerBullet:
             Life--;
             if (Life == 0)
                 DestroyedPlayerEvent();
             break;
         case CollidableType.FriendBullet:
             Life--;
             break;
         case CollidableType.FriendlyShip:
             Life = 0;
             break;
         case CollidableType.Station:
             Life--;
             break;
         case CollidableType.FriendBase:
             Life = 0;
             break;
         case CollidableType.FriendMissle:
             Life = 0;
             if (Life == 0)
                 DestroyedPlayerEvent();
             break;
         case CollidableType.Asteroid:
             Life = 0;
             break;
     }
 }
Exemplo n.º 26
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.EnemyBullet:
             Life--;
             break;
         case CollidableType.EnemyShip:
             Life = 0;
             break;
         case CollidableType.Station:
             Life--;
             break;
         case CollidableType.EnemyBase:
             Life = 0;
             break;
         case CollidableType.Asteroid:
             Life = 0;
             break;
     }
 }
Exemplo n.º 27
0
 public ObjectiveDrawable(CollidableType type, float radius, float rotationSpeed, BasicModel model, Vector3 position, Quaternion rotation)
 {
     _model = model;
     this.CollidableType = type;
     this.BoundingSphereRadius = radius;
     _position = position;
     Position = _position; //Update the main branched Objective position.
     _rotation = rotation;
     _rotationSpeed = rotationSpeed;
     IsDrawable = true;
 }
Exemplo n.º 28
0
 public CollidableRect(string string_0, bool bool_0, int int_0, int int_1, int int_2, int int_3, CollidableType collidableType_0)
 {
     Class13.NP5bWyNzLwONS();
     base..ctor(collidableType_0, 2, string_0);
     base.Shape  = 2;
     base.Active = bool_0;
     base.Name   = string_0;
     this.Rect   = MapGrid.smethod_2(int_0 - 50, int_1 - 50, int_2 + 100, int_3 + 100);
 }
Exemplo n.º 29
0
 // Generally, there is no collision the player should ignore
 protected override bool ShouldIgnoreCollision(CollidableType collidableType)
 {
     return(false);
 }
Exemplo n.º 30
0
 public ObjectiveDestroyable(CollidableType type, float radius, float rotationSpeed, BasicModel model, Vector3 position, Quaternion rotation, string description, int life, TimeSpan maxTime)
     : base(type, radius, rotationSpeed, model, position, rotation)
 {
     this.Title = description;
     this._drawModel = true;
     _maxTime = maxTime;
     Life = life;
 }
Exemplo n.º 31
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.EnemyBullet:
             Life--;
             break;
         case CollidableType.EnemyShip:
             Life -= 5;
             break;
         case CollidableType.Dock:
             _docked = true;
             break;
         case CollidableType.Asteroid:
             Life -= 5;
             break;
         case CollidableType.FriendlyShip:
             Life -= 5;
             break;
         case CollidableType.Station:
             Life -= 5;
             break;
         case CollidableType.FriendBase:
             Life -= 5;
             break;
     }
 }
Exemplo n.º 32
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
     switch (objectCollidedWithType)
     {
         case CollidableType.EnemyBullet:
             Life--;
             break;
         case CollidableType.FriendlyShip:
             Life--;
             break;
         case Game.Classes.CollidableType.PlayerBullet:
             Life--;
             break;
     }
 }
Exemplo n.º 33
0
 public override void Collision(CollidableType objectCollidedWithType)
 {
 }
Exemplo n.º 34
0
 public Thing(canCollide s, Tile t, CollidableType ty)
 {
     sub = s;
     setTile(t);
     subType = ty;
 }