Ejemplo n.º 1
0
    public void SetDamageFrom(GameObject collider)
    {
        if (isGameOver)
        {
            return;
        }
        EnemyControl2D script = collider.transform.parent.GetComponent <EnemyControl2D>();

        script.SetHealthState(0);
        SetHealthDamage(1);
        DrawDamageEffect();
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        GameObject collider = other.gameObject;

        if (collider.CompareTag("Enemy"))
        {
            EnemyControl2D script = collider.transform.parent.GetComponent <EnemyControl2D>();
            script.SetHealthDamage(damage);
            GameObject instance = Instantiate(detonatorPrefab, tr.position /* + Vector3.up * .1f */, Quaternion.identity) as GameObject;
            instance.transform.parent = detonatorGroup;
            gameObject.SetActive(false);
        }
    }