Example #1
0
        public Ship(ShipModelType s, LocatorService ls)
        {
            _model = s;

            StatBonuses = new ShipBonusHandler();

            Debuffs = new DebuffHandler();

            switch (ShipStats.ShieldType)
            {
            case ShieldTypes.QuickRegen:
                Shields = new QuickRegenShieldHandler(ShipStats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.SlowRegen:
                Shields = new SlowRegenShieldHandler(ShipStats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.NoRegen:
                Shields = new NoRegenShieldHandler(ShipStats, StatBonuses, Debuffs);
                break;
            }

            RecalculateModuleBonuses();

            Cargo = new CargoHandler_ReadOnlyVM <CargoHandlerModel>(s.Cargo);


            _playerLocator = ls.PlayerLocator;
            _areaLocator   = ls.AreaLocator;
            _teamLocator   = ls.TeamLocator;
        }
Example #2
0
        /// <summary>
        /// Used only for tempShips
        /// </summary>
        //public Ship()
        //{
        //    ShipStats = new ShipStats();
        //    StatBonuses = new ShipBonusHandler();

        //    Debuffs = new DebuffHandler();
        //    Shields = new QuickRegenShieldHandler(ShipStats, StatBonuses, Debuffs);
        //}

        public Ship(int shipID,
                    int playerID,
                    string playerName,
                    ShipStats stats,
                    ParticleManager particleManager,
                    SpriteBatch spriteBatch,
                    HashSet <int> teams)
        {
            _particleManager = particleManager;
            _spriteBatch     = spriteBatch;
            _rand            = new Random(7747);

            _weapons = new List <Weapon>();

            BodyBehaviors = new List <IBodyBehavior>();

            this.Id         = shipID;
            this.playerID   = playerID;
            this.playerName = playerName;
            Teams           = teams;


            lastTimeStamp = 0;

            IsSelected = false;

            PotentialTargets = new Dictionary <int, ITargetable>();

            Cargo = new CargoHandler_ReadAddRemoveVM <CargoHandlerModel>();

            Modules = new Dictionary <int, Module>();

            StatBonuses = new ShipBonusHandler();

            Debuffs = new DebuffHandler();

            switch (stats.ShieldType)
            {
            case ShieldTypes.QuickRegen:
                Shields = new QuickRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.SlowRegen:
                Shields = new SlowRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.NoRegen:
                Shields = new NoRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;
            }

            ShipStats = stats;

            RecalculateModuleBonuses();

            CreateDictionaries(ShipStats.Energy);
        }
Example #3
0
        public Ship(ShipStats stats, LocatorService ls)
        {
            _model   = new ShipModelType();
            PosX     = 0;
            PosY     = 0;
            Rotation = 0;
            VelY     = 0;
            VelX     = 0;
            _weapons = new List <Weapon>();
            _model.MissileLauncherSlot = 0;
            _weapons.Add(new MissileLauncher(ProjectileTypes.AmbassadorMissile));



            TimeOfLastCollision = 0;
            TimeOfLastDamage    = 0;
            DoCombatUpdates     = false;

            HealthUpdatePeriod = 500;

            _model.PlayerID     = null;
            _simulatingPlayerID = null;
            IsNPC = false;


            _playerLocator = ls.PlayerLocator;
            _areaLocator   = ls.AreaLocator;
            _teamLocator   = ls.TeamLocator;


            _model.Modules = new List <Module>();
            StatBonuses    = new ShipBonusHandler();

            Debuffs = new DebuffHandler();

            switch (stats.ShieldType)
            {
            case ShieldTypes.QuickRegen:
                Shields = new QuickRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.SlowRegen:
                Shields = new SlowRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;

            case ShieldTypes.NoRegen:
                Shields = new NoRegenShieldHandler(stats, StatBonuses, Debuffs);
                break;
            }
            ShipStats = stats;


            _model.Cargo = new CargoHandlerModel();
            Cargo        = new CargoHandler_ReadOnlyVM <CargoHandlerModel>(_model.Cargo);
            SetHealthAndShields(stats);
        }
Example #4
0
        public DefensiveMine(float xPos, float yPos, int galaxyID, int ownerID, int currentAreaID, IPlayerLocator playerLocator) : base(xPos, yPos, galaxyID, ownerID, currentAreaID)
        {
            _model = new DefensiveMineModel(base._model);
            _model.StructureType = StructureTypes.DefensiveMine;
            Debuffs = new DebuffHandler();

            Id = galaxyID;

            _playerLocator = playerLocator;
            _model.Weapon  = new MineWeapon();
        }
Example #5
0
        public Turret(int galaxyID, float xPos, float yPos, int ownerID, int currentAreaID, TurretTypes turretType, IPlayerLocator pl)
            : base(xPos, yPos, galaxyID, ownerID, currentAreaID)
        {
            _model = new TurretModel(base._model, turretType);
            _model.StructureType = StructureTypes.LaserTurret;
            Debuffs = new DebuffHandler();

            Id = galaxyID;

            _playerLocator = pl;
            _model.Weapon  = new AltLaser();
        }
Example #6
0
 public Turret(TurretModel tm, IPlayerLocator pl) : base(tm)
 {
     _playerLocator = pl;
     Debuffs        = new DebuffHandler();
 }