コード例 #1
0
    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());
    }
コード例 #2
0
    private void DecreaseLevel()
    {
        FireLevel = (EFireLevels)((int)FireLevel - 1);
        //FireLevel = 0;
        bLevelDecreaseCoolDown = true;

        UpdateFireParticles();
        StartCoroutine(ResetDecreaseWaitLatch(LevelDownCooldownTime));
    }
コード例 #3
0
    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));
    }
コード例 #4
0
    ///<summary>Used for instantiating the Fire's level</summary>
    public void SetLevel(EFireLevels newLevel)
    {
        FireLevel = (int)FireLevel > (int)newLevel? FireLevel : newLevel;

        UpdateFireParticles();
    }