public bool Insert(PartSelectionBehavior _selection)
        {
            int count = this.GetCount(_selection);

            this.SetCount(_selection, count + 1);
            return(true);
        }
        public PartSelectionBehavior Take(PartSelectionBehavior _selectionPrefab)
        {
            PartSelectionBehavior taken = null;

            if (this.GetCount(_selectionPrefab) > 0 || infiniteResources)
            {
                taken = _selectionPrefab;
                if (taken != null && !infiniteResources)
                {
                    //successfully retrieved selection, decriment the count
                    int newCount = this.GetCount(_selectionPrefab) - 1;
                    this.SetCount(_selectionPrefab, newCount);
                }
            }
            return(taken);
        }
 public void ChangeDisplayedPart(PartSelectionBehavior partInformationToDisplay)
 {
     CurrentlyDisplayedPart = partInformationToDisplay;
 }
 private int GetCount(PartSelectionBehavior _selectionPrefab)
 {
     return(this.m_counts.getData(_selectionPrefab));
 }
 private void SetCount(PartSelectionBehavior _selectionPrefab, int newVal)
 {
     this.m_counts.setData(_selectionPrefab, newVal);
 }
예제 #6
0
 void Start()
 {
     partIcon     = (partIcon == null) ? (GetComponentInChildren <UnityEngine.UI.Image>()) : (partIcon);
     partNameText = (partNameText == null) ? (GetComponentInChildren <UnityEngine.UI.Text>()) : (partNameText);
     Part         = Part;     //initializes the current part according to it's current value
 }
예제 #7
0
 void Start()
 {
     PartInfo = partInfo;
 }