// Shoot a set of objects at the player from each paw IEnumerator C_PawShoot(float StartDelay) { yield return(new WaitForSeconds(StartDelay)); if (LeftArm.gameObject.activeInHierarchy) { LeftArm.SetDeathTimer(0, 5); LeftArm.MoveToPosition_Y(0, gameObject.transform, 1); LeftArm.ShootAtTarget_Player(2, 0.2f, 15, 2); LeftArm.MoveObjectToPoint(6, LeftArmStartingPosition, 1); } if (RightArm.gameObject.activeInHierarchy) { RightArm.SetDeathTimer(0, 5); RightArm.MoveToPosition_Y(0, gameObject.transform, 1); RightArm.ShootAtTarget_Player(2, 0.2f, 15, 2); RightArm.MoveObjectToPoint(6, RightArmStartingPosition, 1); } for (float I = 2; I < 5; I = I + 0.2f) { CenterHead.PlayClip(I, Bullet2); } yield return(new WaitForSeconds(7)); }
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 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)); }
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; }