Пример #1
0
    // destroy self and spawn pfx and sfx objects that will stick around to do fx stuff after i'm gone
    private void BreakSelf(Stimulus breakStim)
    {
        Debug.Log(gameObject + ", breaking self!");

        if (breakSFX != null)
        {
            GameObject sfx = (GameObject)Instantiate(breakSFX.gameObject, transform.position, transform.rotation) as GameObject;
            Destroy(sfx, 30f);

            RandomizedSFX rsfx = sfx.GetComponent <RandomizedSFX>();
            rsfx.PlaySFX();
        }

        if (breakPFX != null)
        {
            GameObject pfx = (GameObject)Instantiate(breakPFX, transform.position, transform.rotation) as GameObject;
            Destroy(pfx, 60f);
        }

        VRInteractable interactable = this.gameObject.GetComponent <VRInteractable>();

        if (interactable != null)
        {
            interactable.GetDropped(false);
        }


        Destroy(this.gameObject);
    }