void Start() { _gksh = GameObject.Find("GKSH").GetComponent <Rigidbody>(); _grabbable = GetComponent <SVGrabbable>(); GrabChanged += React; _previousInHand = _grabbable.inHand; }
// Use this for initialization void Start() { this.grabComponent = GetComponent <SVGrabbable> (); this.fireBulletComponent = GetComponent <SVFireBullet> (); this.input = this.gameObject.GetComponent <SVControllerInput> (); linearAccelerationTracker = new SVLinearAcceleration(); revolvingBarrel.revolverParent = this; this.SetupComponents(); }
void OnValidate() { if (this.grabComponent == null) { this.grabComponent = GetComponent <SVGrabbable> (); } if (this.fireBulletComponent == null) { this.fireBulletComponent = GetComponent <SVFireBullet> (); } SetupComponents(); }
private void OnCollisionEnter(Collision collision) { bool cancelCollision = true; if (collision.gameObject.GetComponent <SVGrabbable>()) { SVGrabbable grabbable = collision.gameObject.GetComponent <SVGrabbable>(); if (grabbable.isKnockable) { cancelCollision = false; } } if (cancelCollision) { Physics.IgnoreCollision(collision.collider, this.controllerCollider); } }
void Start() { leverHingeJoint = GetComponent <HingeJoint>(); JointLimits limits = leverHingeJoint.limits; limits.max = Mathf.Max(leverOnAngle, leverOffAngle); limits.min = Mathf.Min(leverOnAngle, leverOffAngle); leverHingeJoint.limits = limits; leverHingeJoint.useLimits = true; // Get a grabbable on the Lever or one of it's children. You could technically have the grabbable outside of the lever // And connect it with a fixed joint, if so just set grabbable to public and set it in editor. SVGrabbable[] grabbables = (SVGrabbable[])SVUtilities.AllComponentsOfType <SVGrabbable>(gameObject); Assert.IsFalse(grabbables.Length > 1, "SVLever only supports one grabbing surface at a time."); Assert.IsFalse(grabbables.Length <= 0, "SVLever requires a grabble component on it, or a child object, to function."); grabbable = grabbables[0]; startingEuler = this.transform.localEulerAngles; UpdateHingeJoint(); }
void Start() { grabbable = this.GetComponent <SVGrabbable>(); input = this.GetComponent <SVControllerInput>(); }
void Start() { slider = GetComponent <SVSlider>(); grabbable = GetComponent <SVGrabbable>(); }