Esempio n. 1
0
    public static bool checkSlotAvailability(HullType hullType, HullSlot.Type slotType, int index)
    {
        if (slotAvailables == null)
        {
            slotAvailables = new Dictionary <HullType, List <bool> >();
            foreach (HullType hType in Enum.GetValues(typeof(HullType)))
            {
                List <bool> avail = new List <bool>();
                fillAvailable(hType, avail);
                slotAvailables.Add(hType, avail);
            }
        }

        List <bool> avails = slotAvailables[hullType];

        return(avails[getStartIndex(slotType) + index]);
    }
Esempio n. 2
0
    public HullSlot[] getSlots(HullSlot.Type type)
    {
        switch (type)
        {
        case Slot.Type.RADAR: return(new HullSlot[] { radarSlot });

        case Slot.Type.ENGINE: return(new HullSlot[] { engineSlot });

        case Slot.Type.GENERATOR: return(new HullSlot[] { generatorSlot_1, generatorSlot_2, generatorSlot_3 });

        case Slot.Type.HARVESTER: return(new HullSlot[] { harvesterSlot_1, harvesterSlot_2 });

        case Slot.Type.REPAIR_DROID: return(new HullSlot[] { repairDroidSlot_1, repairDroidSlot_2, repairDroidSlot_3, repairDroidSlot_4 });

        case Slot.Type.SHIELD: return(new HullSlot[] { shieldSlot_1, shieldSlot_2, shieldSlot_3 });

        case Slot.Type.WEAPON: return(new HullSlot[] { weaponSlot_1, weaponSlot_2, weaponSlot_3, weaponSlot_4, weaponSlot_5 });

        case Slot.Type.ARMOR: return(new HullSlot[] { armorSlot_1, armorSlot_2, armorSlot_3, armorSlot_4, armorSlot_5 });

        default: Debug.Log("Unknown slot type: " + type); return(new HullSlot[0]);
        }
    }
Esempio n. 3
0
    private static int getStartIndex(HullSlot.Type slotType)
    {
        switch (slotType)
        {
        case Type.RADAR: return(0);

        case Type.ENGINE: return(1);

        case Type.GENERATOR: return(2);

        case Type.HARVESTER: return(5);

        case Type.REPAIR_DROID: return(7);

        case Type.SHIELD: return(11);

        case Type.WEAPON: return(14);

        case Type.ARMOR: return(19);

        default: Debug.Log("Unknown type: " + slotType); return(0);
        }
    }
Esempio n. 4
0
 public HullSlot getSlot(HullSlot.Type type, int slotIndex)
 {
     return(getSlots(type)[slotIndex]);
 }
Esempio n. 5
0
 private void highlightSlot(bool hightlight, ItemType itemType)
 {
     if (!hightlight)
     {
         if (itemType.kind() == ItemKind.SHIP_EQUIPMENT)
         {
             foreach (Slot slot in shipData.slots)
             {
                 slot.setActive(false);
             }
         }
         else if (itemType.kind() == ItemKind.EQUIPMENT || itemType.kind() == ItemKind.SUPPLY)
         {
             foreach (Slot slot in playerData.allSlots)
             {
                 slot.setActive(false);
             }
         }
         else
         {
             foreach (Slot slot in shipData.slots)
             {
                 slot.setActive(false);
             }
             foreach (Slot slot in playerData.allSlots)
             {
                 slot.setActive(false);
             }
         }
     }
     else
     {
         if (itemType.kind() == ItemKind.SHIP_EQUIPMENT)
         {
             HullSlot.Type slotType = getItemToHullSlotType(itemType);
             foreach (HullSlot slot in shipData.slots)
             {
                 if (slot.slotType == slotType)
                 {
                     slot.setActive(true);
                 }
             }
         }
         else if (itemType.kind() == ItemKind.EQUIPMENT)
         {
             EquipmentSlot.Type slotType = getItemToEquipmentSlotType(itemType);
             foreach (EquipmentSlot slot in playerData.equipmentSlots)
             {
                 if (slot.slotType == slotType)
                 {
                     slot.setActive(true);
                 }
             }
         }
         else if (itemType.kind() == ItemKind.SUPPLY)
         {
             foreach (Slot slot in playerData.supplySlots)
             {
                 slot.setActive(true);
             }
         }
     }
 }