Beispiel #1
0
    public void HandleOutOfBounds(HealthComponent health)
    {
        if (health == null)
        {
            return;
        }

        Debug.Log(health.gameObject.name + " out of bounds.");
        health.Health        = 0;
        health.IsOutOfBounds = true;

        foreach (var collider in health.GetComponentsInChildren <Collider2D>())
        {
            collider.enabled = false;
        }

        foreach (var particle in health.GetComponentsInChildren <ParticleSystem>())
        {
            particle.Stop();
        }

        FallBody(health.GetComponent <Rigidbody2D>());
        SetRenderOrdering(health.GetComponentsInChildren <SpriteRenderer>());
    }