コード例 #1
0
ファイル: Ship.cs プロジェクト: bsed/Freecon-Galactic
        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;
        }
コード例 #2
0
ファイル: Ship.cs プロジェクト: bsed/Freecon-Galactic
        /// <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);
        }
コード例 #3
0
ファイル: Ship.cs プロジェクト: bsed/Freecon-Galactic
        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);
        }