Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Ennemy")
        {
            HealthComponent targetHealthComponent = other.gameObject.GetComponent <HealthComponent>();
            if (!targetHealthComponent)
            {
                Debug.Log("Trying to attack a target without a healthComponent.");
                return;
            }

            // Apply effect
            foreach (var effect in attackEffect)
            {
                targetHealthComponent.AddModifier(effect);
            }

            PoolSystem.Instance.AddBackToPool(gameObject);
        }
    }