Beispiel #1
0
        public void SetNose(int partID)
        {
            NoseID = partID;
            PartData part = PartData.Noses[partID].Copy();

            if (Nose != null)
            {
                if (Nose.WeaponSlots != null)
                {
                    foreach (Vector3 pos in Nose.WeaponSlots)
                    {
                        if (Weapons[pos] != null)
                        {
                            weaponWeight -= Weapons[pos].Weight;
                        }
                        Weapons.Remove(pos);
                    }
                }
            }
            Nose = part;
            if (part.WeaponSlots != null)
            {
                foreach (Vector3 pos in part.WeaponSlots)
                {
                    Weapons.Add(pos, null);
                }
            }
        }
Beispiel #2
0
        public void SetEngine(int partID)
        {
            EngineID = partID;
            PartData part = PartData.Engines[partID].Copy();

            if (Engine != null)
            {
                if (Engine.WeaponSlots != null)
                {
                    foreach (Vector3 pos in Engine.WeaponSlots)
                    {
                        if (Weapons[pos] != null)
                        {
                            weaponWeight -= Weapons[pos].Weight;
                        }
                        Weapons.Remove(pos);
                    }
                }
            }
            Engine = part;
            if (part.WeaponSlots != null)
            {
                foreach (Vector3 pos in part.WeaponSlots)
                {
                    Weapons.Add(pos, null);
                }
            }
        }
Beispiel #3
0
        public PartData Copy()
        {
            PartData copy = new PartData(Name, Description, resourceID, Weight, Armor, EquipmentSlots, null, Turn, Thrust, Strafe);

            if (WeaponSlots != null)
            {
                copy.WeaponSlots = new Vector3[WeaponSlots.Length];
                for (int i = 0; i < WeaponSlots.Length; i++)
                {
                    copy.WeaponSlots[i] = WeaponSlots[i];
                }
            }
            copy.Resource = Resources.GetResource(resourceID);
            copy.Hitbox   = Resources.GetEntity(Vector3.Zero, resourceID);
            return(copy);
        }
Beispiel #4
0
 static Vector3? FreeSlot(ShipData ship, PartData part)
 {
     if (part.WeaponSlots == null) return null;
     foreach (Vector3 offset in part.WeaponSlots)
     {
         if (ship.Weapons[offset] == null) return offset;
     }
     return null;
 }
Beispiel #5
0
        void ResetAvailableWeapons(PartData part)
        {
            Weapon1.Available = false;
            Weapon2.Available = false;
            Weapon3.Available = false;
            Weapon4.Available = false;
            if (part.WeaponSlots != null)
            {
                Weapon1.Available = true;
                if (part.WeaponSlots.Length > 1)
                {
                    Weapon2.Available = true;
                    if (part.WeaponSlots.Length > 2)
                    {
                        Weapon3.Available = true;
                        if (part.WeaponSlots.Length > 3)
                        {
                            Weapon4.Available = true;
                        }
                    }

                }
            }
        }
Beispiel #6
0
 public PartData Copy()
 {
     PartData copy = new PartData(Name, Description, resourceID, Weight, Armor, EquipmentSlots, null, Turn, Thrust, Strafe);
     if (WeaponSlots != null)
     {
         copy.WeaponSlots = new Vector3[WeaponSlots.Length];
         for (int i = 0; i < WeaponSlots.Length; i++)
             copy.WeaponSlots[i] = WeaponSlots[i];
     }
     copy.Resource = Resources.GetResource(resourceID);
     copy.Hitbox = Resources.GetEntity(Vector3.Zero,resourceID);
     return copy;
 }