public void SetObject(GameObject o) { selfObject = o; avatar = o.transform.Find("Avatar").gameObject; confirmObject = o.transform.FindChild("Confirm").gameObject; rotationScript = avatar.GetComponent <RandomRotation> (); }
void Start() { c = GetComponent <CharacterController>(); impulse = gameCamera.GetComponent <CinemachineImpulseSource>(); tornadoRenderer = tornado.GetComponent <Renderer>(); lightRenderer = light.GetComponent <Renderer>(); tornadoRenderer.material.SetFloat("Opacity", 0); lightRenderer.material.SetFloat("Opacity", .3f); randomRot = GetComponent <RandomRotation>(); anim = GetComponent <Animator>(); }
public RandomRotation Clone() { RandomRotation clone = new RandomRotation(); clone.transform = transform; clone.axis = axis; clone.uniform = uniform; clone.min = min; clone.max = max; return(clone); }
static public RandomRotation[] CloneArray(RandomRotation[] sources) { int len = sources.Length; RandomRotation[] clones = new RandomRotation[len]; for (int i = 0; i < len; i++) { clones[i] = sources[i].Clone(); } return(clones); }
private void RandomizeRotation() { int len = rotations.Length; for (int i = 0; i < len; i++) { RandomRotation rotationRandomization = rotations[i]; if (defaultToBaseTransform) { rotationRandomization.transform = defaultTransform; } if (rotationRandomization.transform != null) { Vector3 rotation = rotationRandomization.transform.localEulerAngles; float rotationValue = Random.Range(rotationRandomization.min, rotationRandomization.max); Axis axis = rotationRandomization.axis; // x if (axis == Axis.X || axis == Axis.XZ || axis == Axis.XYZ) { rotation.x = rotationValue; } // y if (!rotationRandomization.uniform) { rotationValue = Random.Range(rotationRandomization.min, rotationRandomization.max); } if (axis == Axis.Y || axis == Axis.YZ || axis == Axis.XYZ) { rotation.y = rotationValue; } // z if (!rotationRandomization.uniform) { rotationValue = Random.Range(rotationRandomization.min, rotationRandomization.max); } if (axis == Axis.Z || axis == Axis.XZ || axis == Axis.XYZ) { rotation.z = rotationValue; } rotationRandomization.transform.localEulerAngles = rotation; } } }
static void Init() { RandomRotation window = (RandomRotation)EditorWindow.GetWindow(typeof(RandomRotation)); window.Show(); }
private void Start() { randomRot = GetComponent <RandomRotation>(); capture = FindObjectOfType <CaptureScript>(); }