How to create a Damage Over Time Handler - Unity

Поделиться
HTML-код
  • Опубликовано: 11 ноя 2024

Комментарии • 16

  • @HoodStrats
    @HoodStrats 6 лет назад +13

    My favorite part about your vidz is that they're not super rehearsed. We get to see you mess up and the thought process behind it all. Really helps with the learning tbh.

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  6 лет назад +1

      When I started making the videos that was my intention :) I think it's better than having a fast, perfect video because that's not what coding is actually like. If I get stuck for like 10+ mins then I'll stop and start the recording again haha.

  • @bigbird180
    @bigbird180 2 года назад

    As always, a bloody brilliant video! cheers mate.

  • @toot8208
    @toot8208 Год назад

    you're literally so cool, thank you for this

  • @andreskushnir2356
    @andreskushnir2356 6 лет назад +2

    Very informative and useful. Thank you!

  •  3 года назад +2

    "Paint is the best tool to explain things" - GOD

  • @Husmanmusic
    @Husmanmusic 3 года назад

    Awesome Tutorial!

  • @xxyv
    @xxyv 3 года назад +1

    whats your main on league

  • @jehreetv
    @jehreetv 5 лет назад +1

    Question, why is the For Loop inside of the While Loop necessary? And does that For Loop finish before the While Loop finishes a single loop, or are they looping simultaneously? I would think that you could just decrement the burnTickTimers.Count in the While Loop without the For Loop.. super confused x.x

    • @DapperDinoCodingTutorials
      @DapperDinoCodingTutorials  5 лет назад

      It's because if there are multiple burns on the target I only want to deal damage from one of them, not all 3. In about a month's time when my exams are over I will be remaking a lot of my older videos to be better/more efficient/more expandable and it's very likely that I will be covering this again.

  • @DustinjBailey
    @DustinjBailey 4 года назад

    So how do you stack burns.?

    • @daredeflon662
      @daredeflon662 3 года назад

      You could create a script that handles only Damage Over Time effects and you could have a dictionary of Damage Over Time Effects. Basically you would start the DOT coroutine multiple times. The reason you would need a Dictionary is that you can keep track of every DOT in case you will have a spell like Dispel where you can remove some or all dots.

    • @jakubwozniak6405
      @jakubwozniak6405 2 года назад

      Instead starting coroutine only if burnTickTimers

    • @daredeflon662
      @daredeflon662 Год назад +1

      @Ghost Phoenix I strongly suggest looking into Dictionaries in the Unity documentary, It's a pretty simple yet resourceful tool which allows you to assign values to keys. Key and values can be virtually any type. For example you can have "string" keys for "int" values, or "int" keys for "bool" values or you name it. Basically you can make a dictionary which has "Coroutine" type keys and "IEnumerator" values. and you can assign coroutines to Keys to keep track of them. Whenever you want to remove a DOT ( an active coroutine ) you refer to its key. If you have any questions, feel free.

  • @jeremyelliott5279
    @jeremyelliott5279 Год назад

    I know this is 4 years into the future... but once my character "dies" and respawns the coroutine is still running until the timers are finished. What would i do if i wanted to stop the coroutines as soon as i respawn?
    Edit: if you want to stop the routines once your player dies, here is an example of what i did
    damageTickTimer.RemoveAll(i => i == 0 || healthScript.currentHealth