示例#1
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("Enemy"))
        {
            if (collision.gameObject.GetComponent <stack>() != null)
            {
                stack collidedStackScript = collision.gameObject.GetComponent <stack>();

                if (collidedStackScript.stackAmount >= stackAmount)
                {
                    collidedStackScript.stackAmount += stacked;
                    collidedStackScript.addStackAmount();
                    Destroy(gameObject);
                }
            }
        }
    }