Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class InteractableParticleSystemObject : VRTK.VRTK_InteractableObject {
- public ParticleSystem ps;
- public int triggerBurst = 50;
- void Start() {
- if (ps == null) {
- ps = GetComponent<ParticleSystem> ();
- if (ps == null) {
- ps = GetComponentInChildren<ParticleSystem> ();
- }
- }
- ps.Stop ();
- this.isGrabbable = true;
- this.isUsable = true;
- }
- public override void StartUsing(VRTK.VRTK_InteractUse usingObject) {
- base.StartUsing(usingObject);
- ps.Play ();
- ps.Emit (triggerBurst);
- }
- public override void StopUsing(VRTK.VRTK_InteractUse usingObject) {
- base.StopUsing(usingObject);
- ps.Stop ();
- }
- public virtual void Grabbed(VRTK.VRTK_InteractGrab currentGrabbingObject = null) {
- base.Grabbed (currentGrabbingObject);
- VRTK.VRTK_InteractUse iu = currentGrabbingObject.gameObject.GetComponent<VRTK.VRTK_InteractUse> ();
- if (iu == null) {
- iu = currentGrabbingObject.gameObject.AddComponent<VRTK.VRTK_InteractUse> ();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement