示例#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);
    }
示例#2
0
    // returns true if this damage killed player, otherwise false
    private bool TakeDamage(int damageAmount)
    {
        if (damageSound != null)
        {
            damageSound.PlaySFX();
        }

        return(false);
    }
示例#3
0
    // this is the base Trigger(), individual traps should override this for specific behavior when triggered
    protected virtual bool Trigger()
    {
        if (blockState != WallBlockState.Active)
        {
            return(false);
        }

        if (triggerSFX != null)
        {
            triggerSFX.PlaySFX();
        }

        return(true);
    }