// Start is called before the first frame update void Start() { // Reset timer currentTime = 0; // Cache rigidbody if (rigid == null) { // Just added as a precaution Debug.Log("Rigidbody is found through an expensive method. This is not good. There might be an error in pooling. Consider checking what you changed in script."); rigid = GetComponent <Rigidbody>(); } rigid.useGravity = false; // Disable gravity so projectile doesn't fall while being drawn if (bowScript == null) { // Just added as a precaution Debug.Log("StandardizeBow script is found through an expensive method. This is not good. Consider checking what you changed in script."); bowScript = GetComponentInParent <StandardizedBowForHandBool>(); } // Just ensuring that your colliders are trigger instead of actual physics colliders. boxCollider = GetComponent <BoxCollider>(); if (boxCollider != null) { boxCollider.isTrigger = true; } // Hashing is here to prevent using strings for comparison - The projectile pooling is called from the bow. fleshHash = fleshDetectionTagToHash.GetHashCode(); woodHash = woodDetectionTagToHash.GetHashCode(); stoneHash = stoneDetectionTagToHash.GetHashCode(); metalHash = metalDetectionTagToHash.GetHashCode(); projectileHash = transform.tag.GetHashCode(); // audioSource = GetComponent <AudioSource>(); audioSource.playOnAwake = false; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GUILayout.Space(10f); standardized = (StandardizedBowForHandBool)target; if (GUILayout.Button("Find Bow Rig Joints")) { standardized.FindBoneRigs(); } GUILayout.Space(10f); }