void Awake() { FirePrefab = Resources.Load <GameObject>("FireObject"); FireLevel = EFireLevels.Fire_Small; Boundries = new List <Collider>(); var BoundaryObjects = GameObject.FindGameObjectsWithTag(GameplayStatics.FIRE_BOUNDARY_TAG) .Where(obj => obj.GetComponent <Collider>()); foreach (var boundary in BoundaryObjects) { Boundries.Add(boundary.GetComponent <Collider>()); } var FireChild = GetComponentsInChildren <ParticleSystem>(); foreach (var child in FireChild) { if (child.CompareTag("FireParticleParent")) { FirePartSystem = child; } if (child.CompareTag("FireParticleChild")) { FirePartChild = child;; } } UpdateFireParticles(); StartCoroutine(TrySpawnFire()); StartCoroutine(TryUpgradeFire()); }
private void DecreaseLevel() { FireLevel = (EFireLevels)((int)FireLevel - 1); //FireLevel = 0; bLevelDecreaseCoolDown = true; UpdateFireParticles(); StartCoroutine(ResetDecreaseWaitLatch(LevelDownCooldownTime)); }
private void IncreaseLevel() { if (FireLevel != EFireLevels.Fire_Large) { bIsIncreasingLevel = true; } FireLevel = (int)FireLevel + 1 <= (int)EFireLevels.Fire_Large ? (EFireLevels)((int)FireLevel + 1) : EFireLevels.Fire_Large; bLevelIncreaseCoolDown = true; UpdateFireParticles(); StartCoroutine(ResetIncreaseWaitLatch(FireLevel == EFireLevels.Fire_Small ? MedFireUpgradeWaitTime : LargeFireUpgradeWaitTime)); }
///<summary>Used for instantiating the Fire's level</summary> public void SetLevel(EFireLevels newLevel) { FireLevel = (int)FireLevel > (int)newLevel? FireLevel : newLevel; UpdateFireParticles(); }