示例#1
0
    public void FractureObject()
    {
        if (isFractured)
        {
            return;
        }
        if (fractureSound != null)
        {
            print("player");

            fractureSound.Play();
        }
        var rb = GetComponent <Rigidbody>();

        rb.useGravity  = false;
        rb.isKinematic = true;

        nonFractured.SetActive(false);
        fractured.SetActive(true);


        if (canExplode)
        {
            Explode(transform.position);
        }
        isFractured = true;
        //OnFractured?.Invoke();
        OnFinancialDamageOccured?.Invoke(GetComponent <Price>().price);

        Destroy(gameObject, destroyDelay);
    }
示例#2
0
    public void TakeFinancialDamage()
    {
        var price = GetComponent <Price>();

        OnFinancialDamageOccured?.Invoke(price.price);
    }