private void OnTriggerEnter2D(Collider2D other)
        {
            if (!destroyed)
            {
                Fire fire = other.GetComponent <Fire>();

                if (fire)
                {
                    Animator fireAnimator = other.GetComponent <Animator>();
                    destroyed = true;
                    fire.transform.localScale     = fireScale;
                    fire.transform.localPosition += (Vector3)fireOffset;

                    fireAnimator.speed = firePlaybackSpeed;

                    if (fire)
                    {
                        spriteBurn.Burn();
                    }
                }
            }
        }
Exemple #2
0
        private void StartBurn()
        {
            health.OnDeath -= StartBurn;
            spriteBurn.Burn();

            Component[] components = gameObject.GetComponents <Component>();

            foreach (var component in components)
            {
                if
                (
                    !(component is Transform ||
                      component is SpriteRenderer ||
                      component is Death ||
                      component is SpriteBurn)
                )
                {
                    Object.Destroy(component);
                }
            }

            HandleDeath();
        }
Exemple #3
0
        private void Burn()
        {
            health.OnDeath -= Burn;

            spriteBurn.Burn();
        }