static GameObject GenerateMoveToward() { GameObject empty = new GameObject(); MoveTowardPlayer tstMove = empty.AddComponent <MoveTowardPlayer>(); RandomBasicParams(tstMove); tstMove.distanceOffset = Random.Range(-10f, 10f); empty.name = "MoveToward"; return(empty); }
// Use this for initialization void Start() { //Get the componants moveTowardPlayerScript = GetComponent <MoveTowardPlayer>(); contactDamageScript = GetComponent <ContactDamage>(); healthScript = GetComponentInChildren <Health>(); //Set the stats of the enemt with values from the EnemyStats class moveTowardPlayerScript.movementSpeed = Data.enemyStats.movementSpeed; contactDamageScript.attackSpeed = Data.enemyStats.attackSpeed; contactDamageScript.damage = Data.enemyStats.damage; healthScript.maxHealth = Data.enemyStats.maxHealth; }
IEnumerator ChooseMode() { yield return(new WaitForSeconds(1)); setText("Now do you want to play the game (red) or free mode (green)?"); sphere1 = spawn.spawnNote(0, 0); sphere2 = spawn.spawnNote(4, 1); MoveTowardPlayer m1 = sphere1.GetComponent <MoveTowardPlayer>(); MoveTowardPlayer m2 = sphere2.GetComponent <MoveTowardPlayer>(); yield return(new WaitForSeconds(2f)); m1.go = false; m2.go = false; }
IEnumerator Tutorial() { MicrophoneFeed.MicSensitivity = 0.01f; tutorialImage.gameObject.SetActive(true); setText("Welcome to Melodia!"); //textAnim.SetTrigger("fadeIn"); yield return(new WaitForSeconds(5)); //textAnim.SetTrigger("transition"); //yield return new WaitForSeconds(0.5f); setText("When you sing, your hands change color. Try it!"); while (!gotFirstNote) { yield return(new WaitForSeconds(0.001f)); // wait to get first note } setText("Nice job!"); //Debug.Log("First note: " + firstNote); PitchUtils.initalizeNoteFrequencies(firstNote, Spawn.s.mode); yield return(new WaitForSeconds(1)); // Make orb appear and stop near them GameObject sphere = spawn.spawnNote(0); MoveTowardPlayer m = sphere.GetComponent <MoveTowardPlayer>(); yield return(new WaitForSeconds(2f)); m.go = false; //textAnim.SetTrigger("transition"); //yield return new WaitForSeconds(0.5f); setText("It's an orb! Listen and match the color, then touch it with your hand."); // Once they hit it, start the game (called in onCollisionEnter of orb) }