Пример #1
0
 private void Start()
 {
     if (isReadyForOGE.GetValue())
     {
         OnReadyForOGEEvent.Invoke();
     }
     if (isAfterOGE.GetValue())
     {
         OnAfterOGE.Invoke();
     }
 }
Пример #2
0
    private IEnumerator StartSpawning()
    {
        while (isSpawning)
        {
            yield return(new WaitForSeconds(spawnRate));

            var randomDir = UnityEngine.Random.Range(0, 2) == 0 ? -1 : 1;
            if (isAbleToSpawn.GetValue())
            {
                var SpawnPosition = playerPosition.position +
                                    new Vector3(distanceFromPlayer * randomDir, UnityEngine.Random.Range(-0.4f, 0f));
                Instantiate(stressPrefab, SpawnPosition, Quaternion.identity);
                isAbleToSpawn.SetValue(false);
            }
        }
    }