Beispiel #1
0
        protected override void Die()
        {
            Message <ReturnToPool <EnemyBehaviour> > .Raise(this);

            //invoke local event and clear the delegate.
            OnEnemyDied?.Invoke();
            OnEnemyDied = null;

            //this used to be ondisable, but Die works just as fine
            inStrafeDistance = false;
            Destroy(GetComponent <PolygonCollider2D>()); //weird fix
            //yeet
            var system = DeathParticlePool.GetPoolObject();

            system.transform.position = transform.position + new Vector3(0, 0, -1.5f); //position needs to be a little offset for it to render correctly.
            var main = system.Main;

            main.startColor = settings.tint;
            system.gameObject.SetActive(true);
        }
    protected override void Awake()
    {
        base.Awake();

        _instance = this;
    }