Beispiel #1
0
        public void UpdateUnit(Unit newUnit)
        {
            bool wasSet = unit != null;

            if (unit != null)
            {
                DeinitializeUnit();
            }

            if (newUnit != null)
            {
                InitializeUnit(newUnit);
            }

            if (unit != null)
            {
                setSound?.Play();
            }
            else if (wasSet)
            {
                lostSound?.Play();
            }

            canvasGroup.blocksRaycasts = unit != null;
            canvasGroup.interactable   = unit != null;
            canvasGroup.alpha          = unit != null ? 1.0f : 0.0f;
        }
Beispiel #2
0
 public void Click()
 {
     if (!buttonContent.IsAlreadyPressed)
     {
         pressSound?.Play();
         buttonContent.Activate();
     }
 }
        private void OnClientSpellFailed(SpellCastResult castResult)
        {
            if (!settings.AllowRepeating)
            {
                foreach (var item in activeErrors)
                {
                    if (item.CastResult == castResult)
                    {
                        return;
                    }
                }
            }

            errorAppearSound?.Play();
            ActionErrorItem newError = GameObjectPool.Take(errorItemPrototype, errorContainer.position, errorContainer.rotation, errorContainer);

            newError.SetErrorText(castResult);
            newError.RectTransform.SetAsFirstSibling();
            activeErrors.Add(newError);
        }