コード例 #1
0
 private void Awake()
 {
     businessCloseFade.onCompleted.AddListener(() =>
     {
         onEditorModeStarted.Invoke();
     });
 }
コード例 #2
0
ファイル: GameMode.cs プロジェクト: FGEbba/SnakeGame
    private void Update()
    {
        timer += Time.deltaTime;

        if (!GameObject.Find("ApplePrefab(Clone)"))
        {
            SpawnFood();
        }

        if (timer > waitTime)
        {
            score++;
            timer -= waitTime;
            scoreEvent.Invoke(score);
        }
    }
コード例 #3
0
    private IEnumerator BusinessTimer()
    {
        var businessSystems = FindObjectsOfType <BusinessSystem>();

        float currentTime = 0f;

        RemainedBusinessTime = 0f;

        while (currentTime < gameModeData.businessTime)
        {
            yield return(null);

            currentTime         += Time.smoothDeltaTime;
            RemainedBusinessTime = gameModeData.businessTime - currentTime;
        }

        RemainedBusinessTime = 0;
        onBusinessTimeOvered.Invoke();

        int remainedCustomerCount = 0;

        while (true)
        {
            foreach (var businessSystem in businessSystems)
            {
                remainedCustomerCount += businessSystem.CustomerCount;
            }

            if (remainedCustomerCount == 0)
            {
                break;
            }
            else
            {
                remainedCustomerCount = 0;
                yield return(null);
            }
        }

        day++;

        businessCloseFade.gameObject.SetActive(true);
        businessCloseFade.StartAnimation();
    }
コード例 #4
0
 public void StartBusiness()
 {
     onBusinessModeStarted.Invoke();
     StartCoroutine("BusinessTimer");
 }