Ejemplo n.º 1
0
    private void ShowIcon(GameObject iconPrefab, bool hideAutomatically = false, float hideDelay = 0.0f)
    {
        IsAnimating = true;
        var iconGameObject = Instantiate(iconPrefab, transform.position, Quaternion.identity);

        if (IconCameraLayer > 0)
        {
            iconGameObject.layer = IconCameraLayer;
        }

        iconGameObject.transform.SetParent(transform);
        var offsetPosition = iconGameObject.transform.position;

        offsetPosition.y = offsetPosition.y + iconGameObject.GetComponent <FeedbackIcon>().YOffset;
        iconGameObject.transform.position = offsetPosition;

        _currentIcon = iconGameObject.GetComponent <FeedbackIcon>();
        _currentIcon.ScaleIn(() =>
        {
            IsAnimating = false;
            if (hideAutomatically)
            {
                HideCurrentIcon(delay: hideDelay);
            }
        });
    }
Ejemplo n.º 2
0
 public void HideCurrentIcon(float delay = 0.0f, Action completion = null)
 {
     if (_currentIcon)
     {
         IsAnimating = true;
         _currentIcon.ScaleOut(delay, () =>
         {
             Destroy(_currentIcon.gameObject);
             _currentIcon = null;
             IsAnimating  = false;
             if (completion != null)
             {
                 completion();
             }
         });
     }
 }
Ejemplo n.º 3
0
    public void PlayAudioForIcon(FeedbackIcon.Icons icon) {
        if (icon == FeedbackIcon.Icons.Fail)
        {
            speaker.PlayOneShot(failedSale);
        }
        else if (icon == FeedbackIcon.Icons.BestOption)
        {
            speaker.PlayOneShot(bestChoice);
        }
        else if (icon == FeedbackIcon.Icons.SecondBestOption)
        {
            speaker.PlayOneShot(secondBestChoice);
        }
        else if (icon == FeedbackIcon.Icons.Full)
        {
            speaker.PlayOneShot(queueFull);
        }
}