void Start() { EventManager.resetObjects += Reset; if (!Projectile.GetComponent <SpriteRenderer> ()) { Projectile.AddComponent <SpriteRenderer> (); } SuperScript = gameObject.AddComponent <NewObjectSpawner> (); Target = new Vector3(Xdirection, Ydirection); SuperScript.EnablePooling = EnablePooling; SuperScript.SetProjectile(0, Projectile); SuperScript.SetDeathTimer(0, DeathTimer); SuperScript.SetKinematicObjects(0, IsKinematic); if (RandomColor) { SuperScript.SetColor_Random(0); } TimeToSpawnObjects = ObjectAmount * ObjectDelay; if (IsEnabled) { StartCoroutine("C_StartCoroutine"); } }
void OnEnable() // Create all of the objects { // Instantiate (BossMusic_Controller); // MusicController.control.Fade_Play_Unfade (BossMusic); MusicController.control.PlayNewClip(BossMusic); NewObjectSpawner TEMP; CenterHead.SetColor(0, Color.white); BackgroundSpin.SetActive(true); CenterHead.UnfadeObject(0, BackgroundSpin, 1f); TEMP = BackgroundSpin.GetComponent <NewObjectSpawner> (); TEMP.RotateDegrees(0, 0.1f, 0, false); TEMP = LeftEar.GetComponent <NewObjectSpawner> (); TEMP.CreateTriangle(0, 0.1f, 9, 0.25f, 0.25f); CenterHead.TESTCOMBINE(3, TEMP); TEMP = RightEar.GetComponent <NewObjectSpawner> (); TEMP.CreateTriangle(0, 0.1f, 9, 0.25f, 0.25f); CenterHead.TESTCOMBINE(3, TEMP); LeftEye = LeftEyeObject.GetComponent <NewObjectSpawner> (); LeftEye.CreateLineInDirection(0, 0, 1, new Vector2(0, 0), 0); LeftEye.RotateDegrees(0, 0, 315, true); // LeftEye.RotateTwordsObject_Player (0, 5, false); RightEye = RightEyeObject.GetComponent <NewObjectSpawner> (); RightEye.CreateLineInDirection(0, 0, 1, new Vector2(0, 0), 0); RightEye.RotateDegrees(0, 0, 315, true); // RightEye.RotateTwordsObject_Player (0, 5, false); TEMP = Mouth.GetComponent <NewObjectSpawner> (); TEMP.CreateCircle(0, 0.1f, 7, 0.5f, 0.5f, 2); TEMP.CreateCircle(0, 0.1f, 5, 0.05f, 0.05f, 1); TEMP.CreateLineInDirection_World(0, 0.1f, 2, new Vector2(0, -1), 0.5f); CenterHead.TESTCOMBINE(3, TEMP); LeftArm.SetColor(0, Color.white); RightArm.SetColor(0, Color.white); CenterHead.CreateCircle(0, 0.05f, 30, 1, 1, 1); LeftArm.CreateSquare(0, 0.1f, 16, 0.5f, 0.4f); RightArm.CreateSquare(0, 0.1f, 16, 0.5f, 0.4f); LeftArm.SetColor_Random(3); RightArm.SetColor_Random(3); StartCoroutine(C_StartBattle()); }
void Awake() // Setup all of the objects { EventManager.resetObjects += Reset; LeftArmStartingPosition = LeftArmObject.transform.localPosition; RightArmStartingPosition = RightArmObject.transform.localPosition; CenterStartingPosition = gameObject.transform.localPosition; StartingMusic = MusicController.control.musicclip; Rigidbody2D TEMPBODY; NewObjectSpawner TEMP; BottomLeftSpawn = BottomLeft.AddComponent <NewObjectSpawner> (); BottomLeftSpawn.SetProjectile(0, Projectile); BottomLeftSpawn.SetColor_Random(0); BottomLeftSpawn.SetDeathTimer(0, 10); BottomRightSpawn = BottomRight.AddComponent <NewObjectSpawner> (); BottomRightSpawn.SetProjectile(0, Projectile); BottomRightSpawn.SetColor_Random(0); BottomRightSpawn.SetDeathTimer(0, 10); if (!BackgroundSpin.GetComponent <NewObjectSpawner>()) { BackgroundSpin.AddComponent <NewObjectSpawner> (); } CenterHead = gameObject.AddComponent <NewObjectSpawner> (); CenterHead.SetProjectile(0, Projectile); CenterHead.SetColor(0, Color.white); TEMPBODY = gameObject.AddComponent <Rigidbody2D> (); TEMPBODY.isKinematic = true; TEMP = LeftEar.AddComponent <NewObjectSpawner> (); TEMP.SetProjectile(0, Projectile); TEMP.SetColor(0, Color.white); TEMP.RotateDegrees(0, 0, 45, true); TEMP = RightEar.AddComponent <NewObjectSpawner> (); TEMP.SetProjectile(0, Projectile); TEMP.SetColor(0, Color.white); TEMP.RotateDegrees(0, 0, 315, true); LeftEye = LeftEyeObject.AddComponent <NewObjectSpawner> (); LeftEye.SetProjectile(0, EyeballPrefab); LeftEye.SetColor(0, Color.white); RightEye = RightEyeObject.AddComponent <NewObjectSpawner> (); RightEye.SetProjectile(0, EyeballPrefab); RightEye.SetColor(0, Color.white); TEMP = Mouth.AddComponent <NewObjectSpawner> (); TEMP.SetProjectile(0, Projectile); TEMP.SetColor(0, Color.white); TEMP.RotateDegrees(0, 0, 260, true); LeftArm = LeftArmObject.AddComponent <NewObjectSpawner> (); LeftArm.SetProjectile(0, Projectile); LeftArm.SetColor(0, Color.white); TEMPBODY = LeftArmObject.AddComponent <Rigidbody2D> (); TEMPBODY.isKinematic = true; RightArm = RightArmObject.AddComponent <NewObjectSpawner> (); RightArm.SetProjectile(0, Projectile); RightArm.SetColor(0, Color.white); TEMPBODY = RightArmObject.AddComponent <Rigidbody2D> (); TEMPBODY.isKinematic = true; }