public IEnumerator BreakUp() { yield return(new WaitForSeconds(time2Break)); vel = rigidbody2D.velocity; crossDir = separationDistance * Vector3.Normalize(Vector3.Cross(new Vector3(vel.x, vel.y, 0), Vector3.forward)); spots = new Vector3[] { transform.position - crossDir, transform.position, transform.position + crossDir }; while (i < 3) { block = Instantiate(Resources.Load(weaponBlockPath), spots[i], Quaternion.identity) as GameObject; weaponBlockScript = block.GetComponent <WeaponBlockScript>(); StartCoroutine(weaponBlockScript.Project()); block.transform.localScale = Vector3.one * 3f; block.rigidbody2D.velocity = vel; block.rigidbody2D.gravityScale = 1f; i++; } explo = Instantiate(Resources.Load("Prefabs/Effects/Explosion"), this.transform.position, this.transform.rotation) as GameObject; explo.transform.localScale = Vector3.one * 5; Destroy(this.gameObject); }
public IEnumerator BreakUp() { yield return new WaitForSeconds (time2Break); vel = rigidbody2D.velocity; crossDir = separationDistance * Vector3.Normalize ( Vector3.Cross (new Vector3 (vel.x,vel.y, 0) , Vector3.forward )) ; spots = new Vector3[]{ transform.position - crossDir, transform.position, transform.position + crossDir }; while (i<3){ block = Instantiate ( Resources.Load (weaponBlockPath) , spots[i] , Quaternion.identity) as GameObject; weaponBlockScript = block.GetComponent<WeaponBlockScript>(); StartCoroutine(weaponBlockScript.Project()); block.transform.localScale = Vector3.one * 3f; block.rigidbody2D.velocity = vel; block.rigidbody2D.gravityScale = 1f; i++; } explo = Instantiate ( Resources.Load("Prefabs/Effects/Explosion"),this.transform.position,this.transform.rotation) as GameObject; explo.transform.localScale = Vector3.one*5; Destroy(this.gameObject); }
public IEnumerator LaunchOverIt() { StartCoroutine (CatalogWeapons ()); StartCoroutine (StopChargeNoise ()); StartCoroutine (chargeDisplay.StopCharger()); if (blockInSlot){ if (chargeDisplay.charger!=0 & !waiting){ //TRIGGER RELEASE BUNDLE// (see below) waiting = true; launchCount++; StartCoroutine (ReleaseNoise ()); StartCoroutine (KickBack ()); StartCoroutine (InitialPassThrough()); if (c1){ StartCoroutine (cameraFollowPlayer1.Shake()); } else{ StartCoroutine (cameraBattleArena.Shake()); } //things that happen to ALL fired weapons blockInSlot.rigidbody2D.WakeUp(); if (blockTypes[0]!=7 && blockTypes[0]!=8 && blockTypes[0]!=13){ //telekineticblocks should float blockInSlot.rigidbody2D.gravityScale = 1f; } if (blockTypes[0]!=11 && blockTypes[0]!=12){ //turretblocks should stay small //blockInSlot.transform.localScale = Vector3.one * 3f; } charger = chargeDisplay.charger; blockInSlot.rigidbody2D.velocity = Vector2.zero; yield return new WaitForEndOfFrame(); blockInSlot.rigidbody2D.AddForce(fDir * (baselineFire + fireSpeed * charger)); blockInSlot.collider2D.isTrigger = false; occupied = false; wasOccupied = false; //Special things that those special blocks do if (blockInSlot.GetComponent<WeaponBlockScript> ()) { weaponBlockScript = blockInSlot.GetComponent<WeaponBlockScript> (); StartCoroutine(weaponBlockScript.Project()); } switch (blockTypes[0]){ case 2: Explode explode = blockInSlot.GetComponent<Explode>(); StartCoroutine(explode.BlowMe()); break; case 3: Freeze freezeScript = blockInSlot.GetComponent<Freeze>(); freezeScript.nowProjectile = true; break; case 4: NeutralSuper neutralSuper = blockInSlot.GetComponent<NeutralSuper>(); StartCoroutine(neutralSuper.BreakUp()); break; case 5: ExplodeSuper explodeSuper = blockInSlot.GetComponent<ExplodeSuper>(); StartCoroutine(explodeSuper.GetIntimate()); break; case 6: // super freeze SuperFreezeBlock freezeSuper = blockInSlot.GetComponent<SuperFreezeBlock>(); freezeSuper.wepDSID = wepDSID; break; case 7: //telekinetic block telekineticBlockScript = blockInSlot.GetComponent<TelekineticBlock>(); occupied = true; wasOccupied = true; telekineticBlockScript.weaponDetectorScript = this; telekineticBlockScript.heroSpot = arm; telekineticBlockScript.player = player; telekineticBlockScript.wepDSID = wepDSID; telekineticBlockScript.GetComponent<WeaponBlockScript>().wepDSID = wepDSID; StartCoroutine (TeleBlockCheck()); StartCoroutine (telekineticBlockScript.Orbit()); StartCoroutine (telekineticBlockScript.StartingOff()); break; case 8: //super telekinetic block superTelekineticBlockScript = blockInSlot.GetComponent<SuperTelekineticBlock>(); superTelekineticBlockScript.weaponDetectorScript = this; superTelekineticBlockScript.character = character; superTelekineticBlockScript.wepDSID = wepDSID; superTelekineticBlockScript.GetComponent<WeaponBlockScript> ().wepDSID = wepDSID; GameObject expo = Instantiate ( Resources.Load("Prefabs/Effects/Telesplosion"),hPos,Quaternion.identity) as GameObject; expo.transform.localScale = Vector3.one; StartCoroutine (superTelekineticBlockScript.Welcome()); break; case -1: MiniCopterBlock miniCopterBlock = blockInSlot.GetComponent<MiniCopterBlock>(); StartCoroutine(miniCopterBlock.BeFree()); break; case 11: //turret block //blockInSlot.transform.localScale = Vector3.one; break; case 12: //super turret block //blockInSlot.transform.localScale = Vector3.one; break; case 13: TeleportalBlock teleB = blockInSlot.GetComponent<TeleportalBlock>(); StartCoroutine(teleB.Phase1()); break; case 15: ShockBlock shockb = blockInSlot.GetComponent<ShockBlock>(); StartCoroutine(shockb.FlipTheSwitch()); break; } StartCoroutine(CatalogWeapons()); yield return new WaitForSeconds(0.01f); waiting = false; //StartCoroutine (ToggleWeapons()); yield return null; } } }
public IEnumerator LaunchOverIt() { StartCoroutine(CatalogWeapons()); StartCoroutine(StopChargeNoise()); StartCoroutine(chargeDisplay.StopCharger()); if (blockInSlot) { if (chargeDisplay.charger != 0 & !waiting) { //TRIGGER RELEASE BUNDLE// (see below) waiting = true; launchCount++; StartCoroutine(ReleaseNoise()); StartCoroutine(KickBack()); StartCoroutine(InitialPassThrough()); if (c1) { StartCoroutine(cameraFollowPlayer1.Shake()); } else { StartCoroutine(cameraBattleArena.Shake()); } //things that happen to ALL fired weapons blockInSlot.rigidbody2D.WakeUp(); if (blockTypes[0] != 7 && blockTypes[0] != 8 && blockTypes[0] != 13) //telekineticblocks should float { blockInSlot.rigidbody2D.gravityScale = 1f; } if (blockTypes[0] != 11 && blockTypes[0] != 12) //turretblocks should stay small //blockInSlot.transform.localScale = Vector3.one * 3f; { } charger = chargeDisplay.charger; blockInSlot.rigidbody2D.velocity = Vector2.zero; yield return(new WaitForEndOfFrame()); blockInSlot.rigidbody2D.AddForce(fDir * (baselineFire + fireSpeed * charger)); blockInSlot.collider2D.isTrigger = false; occupied = false; wasOccupied = false; //Special things that those special blocks do if (blockInSlot.GetComponent <WeaponBlockScript> ()) { weaponBlockScript = blockInSlot.GetComponent <WeaponBlockScript> (); StartCoroutine(weaponBlockScript.Project()); } switch (blockTypes[0]) { case 2: Explode explode = blockInSlot.GetComponent <Explode>(); StartCoroutine(explode.BlowMe()); break; case 3: Freeze freezeScript = blockInSlot.GetComponent <Freeze>(); freezeScript.nowProjectile = true; break; case 4: NeutralSuper neutralSuper = blockInSlot.GetComponent <NeutralSuper>(); StartCoroutine(neutralSuper.BreakUp()); break; case 5: ExplodeSuper explodeSuper = blockInSlot.GetComponent <ExplodeSuper>(); StartCoroutine(explodeSuper.GetIntimate()); break; case 6: // super freeze SuperFreezeBlock freezeSuper = blockInSlot.GetComponent <SuperFreezeBlock>(); freezeSuper.wepDSID = wepDSID; break; case 7: //telekinetic block telekineticBlockScript = blockInSlot.GetComponent <TelekineticBlock>(); occupied = true; wasOccupied = true; telekineticBlockScript.weaponDetectorScript = this; telekineticBlockScript.heroSpot = arm; telekineticBlockScript.player = player; telekineticBlockScript.wepDSID = wepDSID; telekineticBlockScript.GetComponent <WeaponBlockScript>().wepDSID = wepDSID; StartCoroutine(TeleBlockCheck()); StartCoroutine(telekineticBlockScript.Orbit()); StartCoroutine(telekineticBlockScript.StartingOff()); break; case 8: //super telekinetic block superTelekineticBlockScript = blockInSlot.GetComponent <SuperTelekineticBlock>(); superTelekineticBlockScript.weaponDetectorScript = this; superTelekineticBlockScript.character = character; superTelekineticBlockScript.wepDSID = wepDSID; superTelekineticBlockScript.GetComponent <WeaponBlockScript> ().wepDSID = wepDSID; GameObject expo = Instantiate(Resources.Load("Prefabs/Effects/Telesplosion"), hPos, Quaternion.identity) as GameObject; expo.transform.localScale = Vector3.one; StartCoroutine(superTelekineticBlockScript.Welcome()); break; case -1: MiniCopterBlock miniCopterBlock = blockInSlot.GetComponent <MiniCopterBlock>(); StartCoroutine(miniCopterBlock.BeFree()); break; case 11: //turret block //blockInSlot.transform.localScale = Vector3.one; break; case 12: //super turret block //blockInSlot.transform.localScale = Vector3.one; break; case 13: TeleportalBlock teleB = blockInSlot.GetComponent <TeleportalBlock>(); StartCoroutine(teleB.Phase1()); break; case 15: ShockBlock shockb = blockInSlot.GetComponent <ShockBlock>(); StartCoroutine(shockb.FlipTheSwitch()); break; } StartCoroutine(CatalogWeapons()); yield return(new WaitForSeconds(0.01f)); waiting = false; //StartCoroutine (ToggleWeapons()); yield return(null); } } }