Exemplo n.º 1
0
    public int GetTotalModuleTypeRackCapacity(RackModule.ModuleType type)
    {
        List <Rack> rackList;

        switch (type)
        {
        case RackModule.ModuleType.HardDrive:
            rackList = storageRacks;
            break;

        case RackModule.ModuleType.Core:
            rackList = coreRacks;
            break;

        case RackModule.ModuleType.Compute:
            rackList = computeRacks;
            break;

        default:
            throw new System.ArgumentNullException("Invalid Module type");
        }

        int capacity = 0;

        foreach (Rack rack in rackList)
        {
            capacity += rack.GetTotalOutput();
        }

        return(capacity);
    }
Exemplo n.º 2
0
    public bool BuyModule(RackModule.ModuleType type)
    {
        StoreItem item = StoreData[type];

        /*
         * if (Money < item.Price)
         * {
         *
         *  Debug.Log("Not enough money");
         *  return false;
         * }
         */

        if (StoreDeliveryPoint.GetComponent <IsTriggered>().Triggered())
        {
            //TODO Inform player the Spawn is blocked
            PlayerAudio.clip = Error;
            PlayerAudio.Play();
            Debug.Log("Item in way of store spawn");
            return(false);
        }

        //Charge the Money
        Money -= item.Price;

        PlayerAudio.clip = Buy;
        PlayerAudio.Play();

        //Spawn Item
        Instantiate(item.Prefab, StoreDeliveryPoint.transform.position, Quaternion.identity);

        return(true);
    }
Exemplo n.º 3
0
    private void SwitchCurrentItem(RackModule.ModuleType itemType)
    {
        currentItem = itemType;

        GameManager.StoreItem item = GameManager.Instance.StoreData[itemType];
        ItemName.text     = item.Name;
        ItemPrice.text    = "£" + item.Price;
        ItemImage.texture = item.Image;
    }
Exemplo n.º 4
0
    public void SellModule(RackModule.ModuleType type)
    {
        StoreItem item = StoreData[type];

        Money           += item.Price;
        PlayerAudio.clip = Buy;
        PlayerAudio.Play();
        Debug.Log("Item Sold");
    }