Example #1
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>();
        }
    }
Example #2
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();
    }
 /// <summary>Accessor for rig override settings</summary>
 public Rig RigSettings(RigID rig)
 {
     return(m_Rigs[(int)rig]);
 }