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 Start() { NewObjectSpawner Object1 = CreateNewObjectSpawner(); Object1.SetProjectile(0, Projectile1); Object1.SetColor(0, Color.red); NewObjectSpawner Object2 = CreateNewObjectSpawner(); Object2.SetProjectile(0, Projectile1); Object2.SetColor(0, Color.blue); NewObjectSpawner Object3 = CreateNewObjectSpawner(); Object3.SetProjectile(0, Projectile1); Object3.SetColor(0, Color.green); NewObjectSpawner Object4 = CreateNewObjectSpawner(); Object4.SetProjectile(0, Projectile1); Object4.SetColor(0, Color.yellow); NewObjectSpawner Object5 = CreateNewObjectSpawner(); Object5.SetProjectile(0, Projectile1); Object5.SetColor(0, Color.gray); Object1.CreateCircle(0, 0.1f, 12, 1, 1, 1); Object1.MoveToPosition_Player_X(2, 1); Object1.MoveToPosition_Player_Y(2, 1); }
// This creates a pinwheel type object void Action1() { NewObjectSpawner Object1 = CreateNewObjectSpawner(); Object1.SetProjectile(0, Projectile1); // Object1.MoveObjectToPoint (0, Object1.gameObject, UpperLeftCorner.position, 0); Object1.CreateMultiLines_World(1, 0.1f, 5, 2, 10); Object1.RotateDegrees(1, null, 1, 360, true); }
// Outward circular spiral - enlarge as it is built void Action2() { NewObjectSpawner Object1 = CreateNewObjectSpawner(); Object1.SetProjectile(0, Projectile1); Object1.CreateCircle_World(1, 0.1f, 25, 0.5f, 0.5f, 1f); Object1.RotateToDegree(1, null, 0.75f, 180, true); Object1.ChangeScale(1, 3.5f, 1f, false); Object1.ChangeColor_Children(5, 1f); }
void Start() { if (GetComponent <HPModule>()) { HPModule TEMP = GetComponent <HPModule>(); TEMP.On_HPModule_Death += MonsterDeath; } EventManager.resetObjects += Reset; startingPosition = gameObject.transform.position; if (JumpPower == 0) { JumpSpeed = 0; } anim = GetComponent <Animator>(); if (DefaultFacingRight) { Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; // BackupScale = theScale; Canvas[] childCanvases = GetComponentsInChildren <Canvas> (); foreach (Canvas child in childCanvases) { theScale = child.transform.localScale; theScale.x *= -1; child.transform.localScale = theScale; } } MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> (); MonsterManipulation.SetProjectile(0, MonsterProjectile); MonsterManipulation.SetToEnablePooling(0, false); if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsGround); calculateChecks.Set_ColliderIndent(ColliderIndent); StartCoroutine(C_StartAI()); }
void Start() { EventManager.resetObjects += Reset; startingPosition = gameObject.transform.position; anim = GetComponent <Animator>(); if (DefaultFacingRight) { Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; Canvas[] childCanvases = GetComponentsInChildren <Canvas> (); foreach (Canvas child in childCanvases) { theScale = child.transform.localScale; theScale.x *= -1; child.transform.localScale = theScale; } } MonsterManipulation = gameObject.AddComponent <NewObjectSpawner> (); MonsterManipulation.SetProjectile(0, MonsterProjectile); MonsterManipulation.SetToEnablePooling(0, false); // MonsterManipulation.AddSelfToList (0); // MonsterManipulation.ChangeColor_Children (0, 1f); // MonsterManipulation.SetColor_Random (0); // MonsterManipulation.SetKinematicObjects (0, false); // ScaleModifier = gameObject.transform.localScale.x; if (GetComponent <CalculateChecks> ()) { calculateChecks = GetComponent <CalculateChecks> (); } else { calculateChecks = gameObject.AddComponent <CalculateChecks> (); } calculateChecks.ChangeLayerMask(whatIsGround); StartCoroutine(C_StartAI()); }
void Awake() { EventManager.resetObjects += Reset; RoomPosition = EntireRoom.transform.position; LeftSpawnPosition = LeftSpawner.transform.position; RightSpawnPosition = RightSpawner.transform.position; BlockToSpawn = new GameObject("CustomBlock"); BlockToSpawn.AddComponent <SpriteRenderer> ().sprite = BlockSpawner_Sprite; BlockToSpawn.tag = "Ground"; BlockToSpawn.transform.position = new Vector2(-8, -8); BlockToSpawn.layer = LayerMask.NameToLayer("SolidObjects"); BlockToSpawn.AddComponent <BoxCollider2D> (); BlockToSpawn.transform.localScale *= 2; BlockToSpawn.GetComponent <SpriteRenderer> ().material = EntireRoom.GetComponent <SpriteRenderer> ().material; Manipluation = GetComponent <NewObjectSpawner> (); O_LeftSpawner = LeftSpawner.AddComponent <NewObjectSpawner> (); O_LeftSpawner.EnablePooling = false; O_LeftSpawner.SetProjectile(0, MedusaHead_Right); O_LeftSpawner.SetDeathTimer(0, 10); O_LeftSpawner.SetColor(0, Color.white); O_RightSpawner = RightSpawner.AddComponent <NewObjectSpawner> (); O_RightSpawner.EnablePooling = false; O_RightSpawner.SetProjectile(0, MedusaHead_Left); O_RightSpawner.SetDeathTimer(0, 10); O_RightSpawner.SetColor(0, Color.white); O_EndPathSpawner = EndPathSpawner.AddComponent <NewObjectSpawner> (); O_EndPathSpawner.SetProjectile(0, BlockToSpawn); O_EndPathSpawner.SetColor(0, Color.white); // StartCoroutine (C_StartRoomActions (0)); }
// Testing multiple objects doing stuff void Action3() { NewObjectSpawner Object1 = CreateNewObjectSpawner(); Object1.SetProjectile(0, Projectile1); Object1.SetColor(0, Color.blue); NewObjectSpawner Object2 = CreateNewObjectSpawner(); Object2.SetProjectile(0, Projectile1); Object2.SetColor(0, Color.red); NewObjectSpawner Object3 = CreateNewObjectSpawner(); Object3.SetProjectile(0, Projectile1); Object3.SetColor(0, Color.green); Object1.CreateCircle(1, 0.1f, 25, 1, 1, 2f); Object2.RotateToDegree(0, null, 0, 180, true); Object2.CreateCircle(3.7f, 0.1f, 25, 1, 1, 2f); Object1.RotateDegrees(7, null, 2, 180, true); Object2.RotateDegrees(7, null, 2, 180, true); Object1.LaunchAtTarget(9, UpperLeftCorner, 2); Object1.StopMovement(10); Object2.LaunchAtTarget(9, UpperRightCorner, 2); Object2.StopMovement(10); Object1.MorphToSquare(9, 1, 1, 0f, 2.5f); Object2.MorphToCircle(9, 1, 1, 0f, 2.5f); Object1.ChangeColor_Children(10, Color.red, 1); Object2.ChangeColor_Children(10, Color.blue, 1); Object1.MorphToCircle(12, 1, 1, 0f, 2); Object2.MorphToSquare(12, 1, 1, 0f, 2); Object2.MorphToCircle(14, 1, 1, 0f, 2); Object1.MoveToPosition(14, CenterOfScreen, 2); Object2.MoveToPosition(14, CenterOfScreen, 2); Object1.ChangeScale(16, 2, 1, false); Object1.RotateDegrees(18, null, 1, 0, true); Object2.RotateDegrees(18, null, -1, 0, true); Object1.StopRotation(21); Object2.StopRotation(21); Object3.MoveToPosition(0, BottomLeftCorner, 0); Object3.CreateLineToTarget(21, 0.002f, 30, UpperRightCorner); Object1.ChangeColor_Children(21, 1); Object2.ChangeColor_Children(21, 1); Object3.BreakRandomly(22, 0.02f, 4); Object1.ChangeScale(24, 0.5f, 3, false); Object2.ChangeScale(24, 0.5f, 1, false); Object1.RotateDegrees(25, null, 1, 0, true); Object2.RotateDegrees(25, null, -1, 0, true); Object1.BreakRandomly(26, 0.1f, 2); Object2.BreakRandomly(26, 0.1f, 2); Object1.ChangeScale(26f, 3f, 1f, false); Object2.ChangeScale(26f, 3f, 1f, false); Object1.StopColorChangeEffect(28); Object2.StopColorChangeEffect(28); Object1.SprayInDirection(30, 40, new Vector3(-0.25f, 1), 0.1f, 3); Object2.SprayInDirection(30, 40, new Vector3(0.25f, 1), 0.1f, 3); Object3.SprayInDirection(30, 80, new Vector3(0.5f, 1f), 0.05f, 7); Object1.EnableObject(33, Exit); Object1.PlayClip(33, ExitClip); }
IEnumerator C_StartBattle() // Start battle and pick a random attack until the hands are disabled { CenterHead.PlayClip(0, IntroRumble); CenterHead.WaveEffectObject(0, 0.1f, 10, 0, 0); CenterHead.MoveObjectToPoint(3, CenterStartingPosition, 1); CenterHead.StopWaveEffect(3); LeftArm.WaveEffectObject(0, 0.5f, 5, 0, 0); LeftArm.StopWaveEffect(2); LeftArm.MoveObjectToPoint(3, LeftArmStartingPosition, 1); RightArm.WaveEffectObject(0, 0.5f, 5, 0, 0); RightArm.StopWaveEffect(2); RightArm.MoveObjectToPoint(3, RightArmStartingPosition, 1); yield return(new WaitForSeconds(3f)); LeftArm.SetProjectile(0, KittenProjectile); RightArm.SetProjectile(0, KittenProjectile); // CenterHead.SetProjectile (0, KittenProjectile); yield return(new WaitForSeconds(1f)); // while((LeftArmObject != null) || (RightArmObject != null)) while ((LeftArmObject.activeInHierarchy) || (RightArmObject.activeInHierarchy)) { int RandomNumber = Random.Range(0, 5); // print(RandomNumber); switch (RandomNumber) { case 0: yield return(StartCoroutine(C_PawStomp(0))); break; case 1: yield return(StartCoroutine(C_PawShoot(0))); break; case 2: yield return(StartCoroutine(C_PawCombine(0))); break; case 3: yield return(StartCoroutine(C_SpinnyHands(0))); break; case 4: yield return(StartCoroutine(C_PawSlam(0))); break; } } yield return(StartCoroutine(C_HeadAttack(0))); yield return(null); }
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; }