public EquipmentSlot(SpaceShipMotor parentShip) { this.parentShip = parentShip; }
/// <summary> /// Fills the ship with random equipment. /// </summary> /// <param name='ship'> /// Ship to mount with equipment. /// </param> public void FillShipWithRandomEquipment(SpaceShipMotor ship) { for (int i = 0; i < engineSlots.Count; i++) { List<EquipmentSaveData> engineEquipment = MidSceneData.Instance.equipmentInLevel.equipment.FindAll (delegate(EquipmentSaveData esd) { return esd.type == EquipmentType.Engine; }); engineSlots [i].MountedEquipment = engineEquipment [Random.Range (0, engineEquipment.Count)]; } for (int i = 0; i < hullSlots.Count; i++) { List<EquipmentSaveData> hullEquipment = MidSceneData.Instance.equipmentInLevel.equipment.FindAll (delegate(EquipmentSaveData esd) { return esd.type == EquipmentType.Hull; }); hullSlots [i].MountedEquipment = hullEquipment [Random.Range (0, hullEquipment.Count)]; } for (int i = 0; i < weaponSlots.Count; i++) { List<EquipmentSaveData> weaponEquipment = MidSceneData.Instance.equipmentInLevel.equipment.FindAll (delegate(EquipmentSaveData esd) { return esd.type == EquipmentType.Weapon; }); weaponSlots [i].MountedEquipment = weaponEquipment [Random.Range (0, weaponEquipment.Count)]; } for (int i = 0; i < miscSlots.Count; i++) { List<EquipmentSaveData> miscEquipment = MidSceneData.Instance.equipmentInLevel.equipment.FindAll (delegate(EquipmentSaveData esd) { return esd.type == EquipmentType.Misc; }); miscSlots [i].MountedEquipment = miscEquipment [Random.Range (0, miscEquipment.Count)]; } }
// Use this for initialization void Start() { shipMotor = GetComponent<SpaceShipMotor> (); shipMotor.TargetSpeed = shipMotor.maxSpeed; shipMotor.isAutoFire = true; }