Example #1
0
        public bool RemoveStatus(StatusDescription desc, bool rmall = false)
        {
            currStatus.TryGetValue(desc, out var holder);
            if (holder == null)
            {
                return(false);
            }

            if (rmall || --holder.ReqCount <= 0)
            {
                Destroy(holder.gameObject);
                currStatus.Remove(desc);
                OnStatusRemoved(desc);
                return(true);
            }
            return(false);
        }
Example #2
0
        public void AddStatus(StatusDescription desc, bool continuous = true)
        {
            currStatus.TryGetValue(desc, out var holder);
            if (holder == null)
            {
                var image = Instantiate(statusImagePrefab, horiLayout, false);
                holder = image.GetComponent <StatusDescriptionHolder>();
                currStatus.Add(desc, holder);

                image.GetComponent <Image>().sprite = desc.statusSprite;
                holder.Desc     = desc;
                holder.ReqCount = 0;

                OnStatusAdded(desc);
            }
            if (continuous)
            {
                ++holder.ReqCount;
            }
        }
Example #3
0
 private void SuppressUnityWarnings()
 {
     desc = null;
 }