bsimser / Inventory-Pro

https://devdog.io
MIT License
2 stars 0 forks source link

When an enemy dies and the loot window is open, the trigger is null when the enemy is finally destroyed. #272

Open bsimser opened 5 years ago

bsimser commented 5 years ago

Original report by Herman Tulleken (Bitbucket: herman_tulleken, ).


A fix is to hide the loot window:

protected virtual IEnumerator SinkIntoGround()
{
    yield return new WaitForSeconds(4.0f * ((useLootWindow) ? 2.0f : 1.0f));
    agent.enabled = false; // To allow for sinking
    float timer = 0.0f;

    while (timer < 3.0f)
    {
        yield return null;

        transform.Translate(0, -1.0f * Time.deltaTime, 0.0f);
        timer += Time.deltaTime;
    }

    if (useLootWindow)
    {
        InventoryManager.instance.loot.window.Hide();
    }

    Destroy(gameObject); // And clean up.
}