Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Token token = other.gameObject.GetComponent <Token>();

        if (token != null)
        {
            changeQty(token.tag, token.qty);
            Destroy(other.gameObject);
            return;
        }

        BasicEnemy enemy = other.gameObject.GetComponent <BasicEnemy>();

        if (enemy != null)
        {
            Vector3 away = gameObject.transform.position - enemy.transform.position;
            AttemptMove <Component>((int)away.x, (int)away.y);
            changeQty("health", enemy.DamageDealt());

            return;
        }

        // TODO create a base AbstractEnemy that inherits off the AbstractAutomaton class so that we can check against that
    }