Esempio n. 1
0
 public void GetDamage()
 {
     if (IsQuestTurn)
     {
         IsQuestTurn = false;
         FireworkSystem.Play();
         QuestIsDone?.Invoke();
     }
     else
     {
         RestartQuest?.Invoke();
     }
 }
Esempio n. 2
0
    private IEnumerator Delay()
    {
        if (IsQuestTurn)
        {
            yield return(new WaitForSeconds(3));

            FireworkSystem.Play();
            IsQuestTurn = false;
            QuestIsDone?.Invoke();
        }
        else
        {
            RestartQuest?.Invoke();
        }
    }
Esempio n. 3
0
    private void FindPlayer()
    {
        float distanceToPlayer = Vector3.Distance(transform.position, _player.transform.position);

        if (distanceToPlayer < _range)
        {
            for (int i = 0; i < _checkPointsCompete.Length; i++)
            {
                if (!_checkPointsCompete[i])
                {
                    _checkPoints[i].gameObject.SetActive(true);
                }
            }

            for (int i = 0; i < _checkPoints.Length; i++)
            {
                float distance = Vector3.Distance(_checkPoints[i].transform.position, _player.transform.position);
                if (distance < 2f)
                {
                    _checkPointsCompete[i] = true;
                }
            }

            if (_checkPointsCompete[0] && _checkPointsCompete[1] && _checkPointsCompete[2] && _checkPointsCompete[3])
            {
                if (IsQuestTurn)
                {
                    FireworkSystem.Play();
                    IsQuestTurn = false;
                    QuestIsDone?.Invoke();
                    _checkPointsCompete[0] = false;
                    _checkPointsCompete[1] = false;
                    _checkPointsCompete[2] = false;
                    _checkPointsCompete[3] = false;
                }
                else
                {
                    _checkPointsCompete[0] = false;
                    _checkPointsCompete[1] = false;
                    _checkPointsCompete[2] = false;
                    _checkPointsCompete[3] = false;
                    RestartQuest?.Invoke();
                }
            }
        }
    }