c # – I'm trying to make a self-destructing enemy and it explodes into some particles after it dies, but it doesn't work

So I want to make an enemy that self-destruct after it collides with the player, but for some reason after the enemy collides with the player, it is not destroyed and only plays the particles. In detail, this is basically what happens: the enemy moves towards the player and the player can use the pistol to shoot him, when the enemy collides with the player, it is not destroyed and continues to chase the player. I have 4 scripts that are responsible for the enemy's death as well as self-destruction.
Parts of the weapons script:

void Shoot()
    {
        Vector2 mousePosition = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
        Vector2 firePointPosition = new Vector2(firePoint.position.x, firePoint.position.y);
        RaycastHit2D hit = Physics2D.Raycast(firePointPosition, mousePosition - firePointPosition, 100, whatToHit);

        Debug.DrawLine(firePointPosition, (mousePosition - firePointPosition) * 100, Color.cyan);
        if (hit.collider != null) //if we hit something, turn the raycast into a different colour
        {
            Debug.DrawLine(firePointPosition, hit.point, Color.red);
            Enemy enemy = hit.collider.GetComponent();
            if (enemy != null)
            {
                enemy.DamageEnemy(Damage);
            }
        }
     }

My player's script:

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour
{

    (System.Serializable)
    public class PlayerStats
    {
        public int maxHealth = 100;

        private int _curHealth;
        public int curHealth
        {
            get { return _curHealth; }
            set { _curHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        public void Init()
        {
            curHealth = maxHealth;
        }
    }

    public PlayerStats stats = new PlayerStats();

    public int fallBoundary = -20;

    (SerializeField)
    private StatusIndicator statusIndicator;

    void Start()
    {
        stats.Init();

        if (statusIndicator == null)
        {
            Debug.LogError("No status indicator referenced on Player");
        }
        else
        {
            statusIndicator.SetHealth(stats.curHealth, stats.maxHealth);
        }
    }

    void Update()
    {
        if (transform.position.y <= fallBoundary)
            DamagePlayer(9999999);
    }

    public void DamagePlayer(int damage)
    {
        stats.curHealth -= damage;
        if (stats.curHealth <= 0)
        {
            GameMaster.KillPlayer(this);
        }

        statusIndicator.SetHealth(stats.curHealth, stats.maxHealth);
    }

}

My enemy script:

using UnityEngine;
using System.Collections;

public class Enemy : MonoBehaviour
{

    (System.Serializable)
    public class EnemyStats
    {
        public int maxHealth = 100;

        private int _curHealth;
        public int curHealth
        {
            get { return _curHealth; }
            set { _curHealth = Mathf.Clamp(value, 0, maxHealth); }
        }

        public int damage = 40;

        public void Init()
        {
            curHealth = maxHealth;
        }
    }

    public EnemyStats stats = new EnemyStats();

    public Transform deathParticles;

    public float shakeAmt = 0.1f;
    public float shakeLength = 0.1f;

    (Header("Optional: "))
    (SerializeField)
    private StatusIndicator statusIndicator;

    void Start()
    {
        stats.Init();

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.curHealth, stats.maxHealth);
        }

        if (deathParticles == null)
        {
            Debug.LogError("No death particles referenced on Enemy");
        }
    }

    public void DamageEnemy(int damage)
    {
        stats.curHealth -= damage;
        if (stats.curHealth <= 0)
        {
            GameMaster.KillEnemy(this);
        }

        if (statusIndicator != null)
        {
            statusIndicator.SetHealth(stats.curHealth, stats.maxHealth);
        }
    }

    void OnCollisionEnter2D(Collision2D _colInfo)
    {
        Player _player = _colInfo.collider.GetComponent();
        if (_player != null)
        {
            _player.DamagePlayer(stats.damage);
            DamageEnemy(9999999);
        }
    }
}

And my game manager script that is responsible for the death and respawn of players and enemies:

using UnityEngine;
using System.Collections;

public class GameMaster : MonoBehaviour
{

    public static GameMaster gm;

    void Awake()
    {
        if (gm == null)
        {
            gm = GameObject.FindGameObjectWithTag("GM").GetComponent();
        }
    }

    public Transform playerPrefab;
    public Transform spawnPoint;
    public float spawnDelay = 2;
    public Transform spawnPrefab;

    public CameraShake cameraShake;

    void Start()
    {
        if (cameraShake == null)
        {
            Debug.LogError("No camera shake referenced in GameMaster");
        }
    }

    public IEnumerator _RespawnPlayer()
    {
        GetComponent().Play();
        yield return new WaitForSeconds(spawnDelay);

        Instantiate(playerPrefab, spawnPoint.position, spawnPoint.rotation);
        Transform clone = Instantiate(spawnPrefab, spawnPoint.position, spawnPoint.rotation) as Transform;
        Destroy(clone, 3f);
    }

    public static void KillPlayer(Player player)
    {
        Destroy(player.gameObject);
        gm.StartCoroutine(gm._RespawnPlayer());
    }

    public static void KillEnemy(Enemy enemy)
    {
        gm._KillEnemy(enemy);
    }
    public void _KillEnemy(Enemy _enemy)
    {
        GameObject _clone = Instantiate(_enemy.deathParticles.gameObject, _enemy.transform.position, Quaternion.identity) as GameObject;
        Destroy(_clone, 5f);
        cameraShake.Shake(_enemy.shakeAmt, _enemy.shakeLength);
        Destroy(_enemy.gameObject);
    }

}

Lastly, it might be worth looking at my (optional) status indicator that manages the health bar:

using UnityEngine;
using UnityEngine.UI;

public class StatusIndicator : MonoBehaviour
{

    (SerializeField)
    private RectTransform healthBarRect;
    (SerializeField)
    private Text healthText;

    void Start()
    {
        if (healthBarRect == null)
        {
            Debug.LogError("STATUS INDICATOR: No health bar object referenced!");
        }
        if (healthText == null)
        {
            Debug.LogError("STATUS INDICATOR: No health text object referenced!");
        }
    }

    public void SetHealth(int _cur, int _max)
    {
        float _value = (float)_cur / _max;

        healthBarRect.localScale = new Vector3(_value, healthBarRect.localScale.y, healthBarRect.localScale.z);
        healthText.text = _cur + "/" + _max + " HP";
    }

}
```

Dungeons and dragons: What is the precedent for what happens to a witch's character levels if his employer dies?

Let's say my multiclass Warlock 3 / Wizard 17 and his group have just killed their patron, fulfilling the dream of a lifetime of being free from an ancestral Covenant with the evil demon. He has zero interest in becoming & # 39; jury and in debt & # 39; To a new entity.

Now, according to this somewhat related question "What happens if the entity with which a sorcerer has a pact is killed?", The accepted answer is basically "Without pattern, without power". That makes sense from the point of view of losing the ability to launch Pact Magic, as well as access to the various class skills that were gained from the demon pattern.

However, there are still 3 levels of characters with whom it is not clear what to do. These levels were obtained through adventure, so what happens to them? Does the experience gained simply evaporate? Is it transferred to the assistant levels?

Obviously, the easy way out is "Depends on the DM". That I am Really Searching is if there has ever been an established precedent for what happens when a character basically loses access to a class. For example, 5e Oathbreaker Paladin shows what happens to a paladin who breaks his oath.

I am interested in finding any precedent set throughout the history of D&D that helps a DM decide how to handle this.

What is the precedent for what happens to the character levels of a sorcerer if his employer dies?

dungeons and dragons: what is the precedence of what happens to the character levels of a sorcerer if his employer dies?

Let's say my multiclass Warlock 3 / Wizard 17 and his group have just killed their patron, fulfilling the dream of a lifetime of being free from an ancestral Covenant with the evil demon. He has zero interest in becoming & # 39; jury and in debt & # 39; To a new entity.

Now, according to this somewhat related question "What happens if the entity with which a sorcerer has a pact is killed?", The accepted answer is basically "Without pattern, without power". That makes sense from the point of view of losing the ability to launch Pact Magic, as well as access to the various class skills that were gained from the demon pattern.

However, there are still 3 levels of characters with whom it is not clear what to do. These levels were obtained through adventure, so what happens to them? Does the experience gained simply evaporate? Is it transferred to the assistant levels?

Obviously, the easy way out is "Depends on the DM". That I am Really Searching is if there has ever been a set of precedence for what happens when a character basically loses access to a class. For example, 5e Oathbreaker Paladin shows what happens to a paladin who breaks his oath.

I am interested in finding any established precedence throughout the history of D&D that helps a DM decide how to handle this.

What is the precedence of what happens to the character levels of a sorcerer if his employer dies?

java – Apache Tomcat http dies, stop accepting requests

I've been dealing with an aggressive robot tracker / attack for the past week.
The bot is distributed with random ips and agent chains, so difficult to block, but I have another thread for that. This problem is that an avalanche of http requests can cause the death of Tomcat.

Tomcat process is still fine and does not run out of memory, just stop accepting http or https requests. The timeout for any http request is timed out, but it will still take https requests (if http is being attacked, sometimes https also dies).

I have seen an error before with "too many open files", so I changed the file limit from 10,000 to 50,000, that seemed to help, at least the death of https, but http still dies. I don't see "too many open files" recently.

It seems like an extreme amount of open files, why would Tomcat open so many files, could it have a file leak under a high load? The server is sometimes fine for 6 months (so it cannot be a leak under normal conditions), but has died under a high load before.

The website is a large site with> 1 million pages (dynamic content) and> 1 million visits per day.

What happens when Tomcat receives an avalanche of http requests (such as> 100 per second for a prolonged period), I suppose the requests will begin to be supported, if using a group of threads there will be no threads, it will continue grouping the requests until something is break or start rejecting requests?

Is there any way to start rejecting requests after a certain amount of support? It seems to be the only way to avoid a death or a crash under extreme load.

My http and https settings are different, so maybe that is related to why http dies. https is using maxThreads where it is not http, (how many threads is the default?)




Using Tomcat v8.5.47, CentOS 7.6, Oracle Java 1.8

18.04 – Audio dies a couple of seconds after running sudo alsa force-reload

On startup, my computer with Ubuntu 18.04 does not play any audio, excluding some system sounds. However, if I execute the command sudo alsa force-reload, the audio works for a couple of seconds, but then quickly turns off and is distorted, which does not produce audio again. Running sudo alsa force-reload It makes this happen again.

How can I make my audio work constantly?

new players: how do you calculate how much gold to give when a monster dies?

I am new to Dungeons and Dragons. I'm curious to know if anyone can tell me how to determine how much gold I give my fellow players when they kill a monster. I want to give them a lot, but I have heard that it may be better to avoid being too generous. Thoughts?
Thank you!

After the mechanical shutter of a mirrorless camera dies, can you still record videos?

A similar question has already been asked about DSLR cameras, but it can be very different in a mirrorless camera (see this page).

So here are my questions:

  1. Can you continue recording videos?

  2. If you have an electronic shutter, can you take pictures?

Please don't say Do not worry about the mechanical shutter. It is very unlikely that you will use it before it is outdated. I don't worry I'm curious.

dnd 5e: What happens to the target of a true "permanent" polymorph spell when your caster dies?

The description of the spell specifically says that after the caster has maintained his concentration for an hour, the spell can dissipate.

The transformation lasts for the duration, or until the target falls to 0 hit points or dies. If you focus on this spell all the time, the spell lasts until it dissipates.

Another question specified that spells that can be dispelled will last until their effect ends. While spells that require concentration, will end with death. However, it does not specify what happens with a spell that initially requires concentration.

If the caster dies after this duration, what happens to the target?

  • Does the objective retain its current form?
  • Does the objective return to the previous form?

dnd 5e: What happens to the soul of a lich when it dies with a Ring of Mind Shielding?

It is not clear that the ring is even activated

The operative part of the description of the Ring of Mind Shielding is:

If you die while wearing the ring, your soul enters it, unless it already houses a soul.

However, the language used to describe the ability of the lich to reconstitute its phylacteria seems to carefully avoid the words "die" or "death." In the description of the Monster Manual process:

Death and Restoration When the body of a lich is broken by accident or assault, the will and mind of the lich are drained, leaving only a dead body. In a matter of days, a new body is reformed next to the phylacterium of the lich, merging with the bright smoke emitted by the device. Because the destruction of its phylacteria means the possibility of eternal death, a lich generally keeps its phylacteria in a hidden and well protected place.

And in the lich statistics block:

Rejuvenation. If it has a phylacterium, a destroyed lich gains a new body in 1d10 days, recovering all its life points and becoming active again. The new body appears less than 5 feet from the phylacteria.

Note that in addition to not mentioning death, the lich rejuvenation trait further It makes no mention of resurrecting the lich from the dead. So, RAW, it seems that a lich with a functional phylacterium does not die when its body is destroyed, which means that the ability to trap souls from the Ring of Mind Shielding is never activated.

Even if the ring is activated, it cannot free the lich soul from the phylacteria

The description of the process of becoming a lich is quite clear that the lich's soul is permanently housed within its phylacterium, as shown in the following extracts (emphasis added):

A lich is created by an arcane ritual that catch the wizard's soul inside a phylacterium. Doing so unites the soul to the mortal world, preventing it from traveling to the outer planes after death.

And in the following paragraph:

With its phylacteria prepared, the future lich drinks a transformation potion: a vile mixture of poison mixed with the blood of a sensitive creature whose soul is sacrificed to the phylacteria. The magician falls dead, then stands up like a lich like his soul is attracted to the phylacteria, where it remains forever.

And most importantly, the sole purpose of the phylacteria is to make it as difficult as possible to access or free the soul of the lich:

Destroying the phylacterium of a lich is not an easy task and often requires a special ritual, object or weapon. Each phylacteria is unique, and discovering the key to its destruction can be a search in itself.

So, even if you, like DM, ruled that the ring was activated after the decorum of the lich (which is not a totally unreasonable decision), I would say that still cannot take the soul of the lychee from its phylacteria, since that is exactly what phylactery is designed for

In summary: the ring cannot catch the soul of the lychee because the soul of the lychee is already trapped in its phylacteria.

edge of the empire's star wars: there are no recoil dies to reduce

Assume a situation in which I can reduce the recoil by 1 die but I have no more recoil to reduce / eliminate; Does that remaining reduction disappear?

Some of these characteristics that allow the reduction of recoil are expensive, so it seems unfortunate that only the benefit disappears.

Traditionally, we have played that the remaining recoil reduction without a real recoil will reduce a difficult die to a recoil die and therefore allow further reductions to be resolved. This feels good, but I can't cite any source to support it.