// Use this for initialization void Start() { tpwc = GetComponent <ThirdPersonWallCover>(); // We don't need to check whether tpwc is null because of the RequireComponent compiler attribute above. // I'm putting both of these into arrays so that I can use a for loop throughout rather than repeat very similar code 4x sensorTransforms = new Transform[4];// { wallLTrans, wallRTrans, zoomLTrans, zoomRTrans }; distances = new float[] { -tpwc.coverTriggerDist, tpwc.coverTriggerDist, -camZoomWallEdgeDist, camZoomWallEdgeDist }; for (int i = 0; i < sensorTransforms.Length; i++) { sensorTransforms[i] = new GameObject("WallEdgeSensor_" + i).transform; sensorTransforms[i].SetParent(transform); sensorTransforms[i].localPosition = new Vector3(distances[i], 1, 0); edgeBools[i] = false; // Just to be sure, though they should have been initialized to false } }
// Use this for initialization void Start() { tpwc = GetComponent <ThirdPersonWallCover>(); noCoverSnap.TransitionTo(0); }