Beispiel #1
0
        public Boolean LoadFromDB(VehicleData data, Int64 vehCoid = 0)
        {
            if (data == null)
                data = DataAccess.Vehicle.GetVehicle(vehCoid);

            if (data == null)
                return false;

            if (data.Ornament != -1L)
            {
                _ornament = new SimpleObject();
                _ornament.LoadFromDB(data.Ornament);
            }

            if (data.RaceItem != -1L)
            {
                _raceItem = new SimpleObject();
                _raceItem.LoadFromDB(data.RaceItem);
            }

            if (data.PowerPlant != -1L)
            {
                _powerPlant = new PowerPlant();
                _powerPlant.LoadFromDB(data.PowerPlant);
            }

            if (data.Wheelset != -1L)
            {
                _wheelSet = new WheelSet();
                _wheelSet.LoadFromDB(data.Wheelset);
            }

            if (data.Armor != -1L)
            {
                _armor = new Armor();
                _armor.LoadFromDB(data.Armor);
            }

            if (data.MeleeWeapon != -1L)
            {
                _meleeWeapon = new Weapon();
                _meleeWeapon.LoadFromDB(data.MeleeWeapon);
            }

            if (data.Front != -1L)
            {
                _weapons[0] = new Weapon();
                _weapons[0].LoadFromDB(data.Front);
            }

            if (data.Turret != -1L)
            {
                _weapons[1] = new Weapon();
                _weapons[1].LoadFromDB(data.Turret);
            }

            if (data.Rear != -1L)
            {
                _weapons[2] = new Weapon();
                _weapons[2].LoadFromDB(data.Rear);
            }

            InitializeFromCBID(data.Cbid, null);
            SetCOID(data.Coid);
            CoidCurrentOwner = data.OwnerCoid;
            TeamFaction = data.TeamFaction;
            Position = new Vector3(data.X, data.Y, data.Z);
            Rotation = new Vector4(data.Q1, data.Q2, data.Q3, data.Q4);
            Velocity = new Vector3();
            AngularVelocity = new Vector3();
            Trim = data.Trim;
            PrimaryColor = data.PrimaryColor;
            SecondaryColor = data.SecondaryColor;
            VehicleName = data.Name;

            IsInDB = true;

            return true;
        }
Beispiel #2
0
 public void SetMeleeWeapon(Weapon weapon)
 {
     _meleeWeapon = weapon;
 }
Beispiel #3
0
 public void AddWeapon(Int32 t, Weapon wep)
 {
     if (t >= 3)
         _meleeWeapon = wep;
     else
         _weapons[t] = wep;
 }