protected override void Start() { base.Start(); if ((randomizedAngle.Length != 0) && (randomizedAngle.Length != 3)) { Debug.Log("randomizedAngle should either be empty or it should have exactly 3 elements corresponding to the X, Y, and Z angles to offset by that amount."); } CodeTools.ValidateMinMaxArray(randomizedAngle, new MinMaxValues(-20f, 0f), new MinMaxValues(0f, 20f)); SpawnArrow(); if (randomizedAngle.Length == 3) { RandomizeArrowAngle(); } if (triggerSFX == null) { triggerSFX = GetComponent <RandomizedSFX>(); } if (triggerSFX == null) { Debug.LogError("triggerSFX not assigned and no RandomizedSFX component detected."); } }
void Start() { if (audioSource == null) { audioSource = GetComponent <AudioSource>(); } if (audioSource == null) { Debug.LogError("No AudioSource assigned or detected."); } if (clips.Length == 0) { Debug.LogError("No AudioClips assigned."); } if ( (clips.Length != clips_randomWeights.Length) || (clips.Length != clips_randPitchRanges.Length) || (clips_randomWeights.Length != clips_randPitchRanges.Length) ) { Debug.LogError("Arrays whose names start with the word 'clips' are parallel arrays and must have the name number of elements."); } CodeTools.ValidateWeightedRandomArray(clips_randomWeights, clips.Length); MinMaxValues minmax = new MinMaxValues(-3f, 3f); CodeTools.ValidateMinMaxArray(clips_randPitchRanges, minmax, minmax); lastTriggerTime = dontTriggerUntil; // this is how dontTriggerUntil is implemented }
void Start() { if (targetTransform == null) { Debug.LogError("targetTransform not assigned."); } if (targetSlot == null) { targetSlot = targetTransform.gameObject.GetComponent <Slot>(); } if (targetSlot == null) { Debug.LogError("targetSlot not assigned, and no Slot component found on targetTransform object."); } if (positionTolerance.Length != 3) { Debug.LogError("positionTolerance must be an array of size 3, where element 0 defines X tolerance, element 1 defines Y tolerance, and element 2 defines Z tolerance."); } MinMaxValues notMoreThanZero = new MinMaxValues(-999f, 0f); MinMaxValues notLessThanZero = new MinMaxValues(0f, 999f); CodeTools.ValidateMinMaxArray(positionTolerance, notMoreThanZero, notLessThanZero); if (rotationTolerance < 0) { Debug.LogError("rotationTolerance must be great than 0."); } if (checkPeriod < 0) { Debug.LogError("checkPeriod must be greater than 0 and should be much less than 1 (try 0.03 maybe)."); } if (startSlotted) { // TODO - this code is pretty much duplicate copy/pasted from below SnapToTargetPosition(); if (targetSlot != null) { targetSlot.ObjectHasSlotted(this); } if (becomeNonphysicalWhenSlotted) { BecomePhysical(false); // do this last, because by default at present VRInteractable will make the object physical again when dropped when CommunicateSnapToOtherScripts() is called } } }