void Start() { audioSources = gameObject.GetComponents <AudioSource>(); clockSrc = audioSources[1]; //make and begin running the state machine rhythmGameStateMachine = new FiniteStateMachine <RhythmGameController>(this); rhythmGameStateMachine.TransitionTo <IntroAnimation>(); noteObjectsParent = transform.GetChild(3).gameObject.GetComponent <Transform>(); lifeSpritesController = transform.GetChild(5).gameObject.GetComponent <Transform>(); //visual utility and feedback scripts fretFeedbackScript = transform.GetChild(0).gameObject.GetComponent <NewFretFeedback>(); orbitterScript = transform.GetChild(1).GetChild(0).gameObject.GetComponent <Orbitter>(); background = transform.GetChild(2).gameObject.GetComponent <SpriteRenderer>(); backgroundScaler = background.gameObject.GetComponent <ScaleObject>(); rhythmGameDialogue = this.gameObject.GetComponent <RhythmGameDialogue>(); //generate the random combination for the second phase of the song and make the song into one string GenerateCombinations(); this.thisSongSequence = notesCombinations.ToArray(); GenerateNotes(); }
/// <summary> /// Creates Orbital objects within the maximum radius away from the orbitter /// </summary> /// <param name="count">Number of objects to create</param> /// <param name="radius">Distance to create them at</param> /// <returns>Array of Objects Created</returns> public Orbitter[] CreateOrbits(int count, int radius) { var obs = new Orbitter[count]; for (int i = 0; i < count; i++) { var ob = Instantiate(orbitTemplate) as Orbitter; ob.transform.position = transform.position + new Vector3(Random.Range(-maxRadius, maxRadius), Random.Range(-10, 10), Random.Range(-maxRadius, maxRadius)); ob.transform.localScale *= Random.Range(0.5f, 1); ob.CenterOfGravity = transform; ob.GetComponent <Rigidbody>().AddForce(transform.right * 5, ForceMode.Impulse); orbits[i] = ob; } return(orbits); }