Exemple #1
0
    private void OnEnable()
    {
        rigController            = FindObjectOfType <RigController>();
        itemDatabase             = FindObjectOfType <ItemDatabase>();
        miningControllerInstance = FindObjectOfType <MiningController>();
        mapDelegateHolder        = FindObjectOfType <MapDelegateHolder>();


        rigController.rigUpgradedActions  += UpgradeARig;
        rigController.rackUpgradedActions += UpgradeARackOfRigs;



        // Populating the rig slot list and assigning IDs
        int i = 0;

        foreach (Transform child in rigSlotHolder)
        {
            rigSlots.Add(child);
            child.GetComponent <Rigslot>().myOrderNumber = i;
            i++;
        }

        // Populating the rack slots list and assigning IDs

        foreach (Transform child in rackSlotHolder)
        {
            rackSlots.Add(child);
            child.GetComponent <RackSlot>().myOrderNumber = i;

            child.GetComponent <RackSlot>().racksInThisGroup = 0;
            i++;
        }
    }
Exemple #2
0
    public void ResetDataForNewApartment()
    {
        Debug.Log("Refreshing data for the new apartment");

        // Find the mape controller for the new apartment
        currentMapController = FindObjectOfType <MapController>();
        mapDelegateHolder    = FindObjectOfType <MapDelegateHolder>();

        // Need to assigne functions to the new delegates
        if (!controllingRack)
        {
            mapDelegateHolder.upgradedRigActions += UpdateMyRigUI;
            myRigID = GetComponent <RigID>();
        }
        else
        {
            mapDelegateHolder.upgradedRackActions += UpdateMyRackUI;
            myRackID = GetComponent <RackID>();
        }
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        currentMapController = FindObjectOfType <MapController>();
        itemDatabase         = FindObjectOfType <ItemDatabase>();
        rigController        = FindObjectOfType <RigController>();
        miningController     = FindObjectOfType <MiningController>();
        mapDelegateHolder    = FindObjectOfType <MapDelegateHolder>();

        if (controllingRack)
        {   // If this UI element controls a rack, then make the button call upgrade a rack function from the rig controller
            upgradeButton.onClick.AddListener(() => rigController.UpgradeARack(GetComponent <RackID>().myControlID));
            myRackID = GetComponent <RackID>();
        }
        else
        {
            upgradeButton.onClick.AddListener(() => rigController.UpgradeARig(GetComponent <RigID>().myControlID));
            myRigID = GetComponent <RigID>();
            myRig   = FindObjectOfType <ItemDatabase>().rigTypes[0];
        }

        // If the center activate button is ON then give it a function of buying a brand new rig
        if (activateButton && !controllingRack)
        {
            activateButton.onClick.AddListener(() => BuyARigFromScratch());
        }
        else
        {
            activateButton.gameObject.SetActive(false);
        }

        if (!controllingRack)
        {
            mapDelegateHolder.upgradedRigActions += UpdateMyRigUI;
        }
        else
        {
            mapDelegateHolder.upgradedRackActions += UpdateMyRackUI;
        }

        InitizalizeTheUI();
    }