//RELEASE BUNDLE END// void OnTriggerStay2D(Collider2D col) { if (!occupied) { if (col.GetComponent <WeaponBlockScript>()) { weaponBlockScript = col.GetComponent <WeaponBlockScript>(); if (!weaponBlockScript.nowProjectile && weaponBlockScript.toggleCount < 1) { blockInSlot = col.gameObject; occupied = true; weaponBlockScript.wepDSID = wepDSID; StartCoroutine(weaponBlockScript.LockIn()); StartCoroutine(CatalogWeapons()); } } else if (col.GetComponent <MiniCopterBlock>()) { miniCopterBlock = col.GetComponent <MiniCopterBlock>(); if (!miniCopterBlock.recovering && miniCopterBlock.toggleCount < 1) { blockInSlot = col.gameObject; occupied = true; miniCopterBlock.wepDSID = wepDSID; StartCoroutine(miniCopterBlock.LockIn()); StartCoroutine(CatalogWeapons()); } } } }
// Use this for initialization void Awake() { count = 0; if (gameObject.name == "Hero1") { characterID = 0; player = GetComponent<Player> (); } else if (gameObject.name == "Hero2"){ characterID = 1; player = GetComponent<Player> (); } else if (GetComponent<MiniCopterBlock> ()) { characterID = 2; miniCopterBlock = GetComponent<MiniCopterBlock> (); } else if (gameObject.GetComponent<TankBlock> ()) { characterID = 3; tankBlock = GetComponent<TankBlock> (); } else if (GetComponent<JumpBlock> ()) { characterID = 4; jumpBlock = GetComponent<JumpBlock> (); } else if (GetComponent<TelekineticBlock> ()) { characterID = 5; telekineticBlock = GetComponent<TelekineticBlock> (); } else if (GetComponent<SuperTelekineticBlock> ()) { characterID = 6; superTelekineticBlock = GetComponent<SuperTelekineticBlock> (); } else if (GetComponent<DestructablePlatform>()){ characterID = 7; destructablePlatform = GetComponent<DestructablePlatform>(); } else if (GetComponent<TurretBlock>()){ characterID = 8; turretBlock = GetComponent<TurretBlock> (); } else if (GetComponent<SuperTurretBlock>()){ characterID = 9; superTurretBlock = GetComponent<SuperTurretBlock> (); } else if (GetComponent<PistonButton>()){ characterID = 10; pistonButton = GetComponent<PistonButton> (); } else{ characterID = 100; } }
// Use this for initialization void Awake() { count = 0; if (gameObject.name == "Hero1") { characterID = 0; player = GetComponent <Player> (); } else if (gameObject.name == "Hero2") { characterID = 1; player = GetComponent <Player> (); } else if (GetComponent <MiniCopterBlock> ()) { characterID = 2; miniCopterBlock = GetComponent <MiniCopterBlock> (); } else if (gameObject.GetComponent <TankBlock> ()) { characterID = 3; tankBlock = GetComponent <TankBlock> (); } else if (GetComponent <JumpBlock> ()) { characterID = 4; jumpBlock = GetComponent <JumpBlock> (); } else if (GetComponent <TelekineticBlock> ()) { characterID = 5; telekineticBlock = GetComponent <TelekineticBlock> (); } else if (GetComponent <SuperTelekineticBlock> ()) { characterID = 6; superTelekineticBlock = GetComponent <SuperTelekineticBlock> (); } else if (GetComponent <DestructablePlatform>()) { characterID = 7; destructablePlatform = GetComponent <DestructablePlatform>(); } else if (GetComponent <TurretBlock>()) { characterID = 8; turretBlock = GetComponent <TurretBlock> (); } else if (GetComponent <SuperTurretBlock>()) { characterID = 9; superTurretBlock = GetComponent <SuperTurretBlock> (); } else if (GetComponent <PistonButton>()) { characterID = 10; pistonButton = GetComponent <PistonButton> (); } else { characterID = 100; } }
public IEnumerator CatalogWeapons() { blockTypes = new int[] {0,0,0,0}; storedWeapons = new GameObject[] {null,null,null,null}; j = 1; numBlocks = 0; while (j<5){ slotCheck = Physics2D.OverlapCircleAll (character.transform.position,3f); //Physics2D.OverlapPointNonAlloc(slot,slotCheck); foreach (Collider2D block in slotCheck) { if (block){ if (block.GetComponent<WeaponBlockScript>()){ weaponBlockScript = block.GetComponent<WeaponBlockScript>(); if (weaponBlockScript.wepDSID == wepDSID){ if ( weaponBlockScript.toggleCount == j ) { blockTypes[j-1] = weaponBlockScript.blockType; storedWeapons[j-1] = block.gameObject; numBlocks++; } } } else if (block.GetComponent<MiniCopterBlock>()){ miniCopterBlock = block.GetComponent<MiniCopterBlock>(); if (miniCopterBlock.wepDSID == wepDSID){ if (miniCopterBlock.toggleCount == j) { blockTypes[j-1] = miniCopterBlock.blockType; storedWeapons[j-1] = block.gameObject; numBlocks++; } } } } else{ blockTypes[j-1] = -1; storedWeapons[j-1] = null; } } j++; } StartCoroutine (GravityMonitor ()); if (!storedWeapons [0]) { occupied = false; } else { occupied = true; blockInSlot = storedWeapons[0]; } yield return null; }
//RELEASE BUNDLE END// void OnTriggerStay2D(Collider2D col) { if (!occupied){ if ( col.GetComponent<WeaponBlockScript>() ) { weaponBlockScript = col.GetComponent<WeaponBlockScript>(); if (!weaponBlockScript.nowProjectile && weaponBlockScript.toggleCount<1){ blockInSlot = col.gameObject; occupied = true; weaponBlockScript.wepDSID = wepDSID; StartCoroutine(weaponBlockScript.LockIn()); StartCoroutine(CatalogWeapons()); } } else if ( col.GetComponent<MiniCopterBlock>() ){ miniCopterBlock = col.GetComponent<MiniCopterBlock>(); if (!miniCopterBlock.recovering && miniCopterBlock.toggleCount<1){ blockInSlot = col.gameObject; occupied = true; miniCopterBlock.wepDSID = wepDSID; StartCoroutine(miniCopterBlock.LockIn()); StartCoroutine(CatalogWeapons()); } } } }
public IEnumerator ToggleWeapons() { playToggle = false; yield return StartCoroutine (CatalogWeapons ()); foreach (GameObject block in storedWeapons) { if (block){ playToggle = true; if (block.GetComponent<WeaponBlockScript>()){ weaponBlockScript = block.GetComponent<WeaponBlockScript>(); weaponBlockScript.lockedin = false; switch (weaponBlockScript.toggleCount){ case 1: weaponBlockScript.toggleCount = 2; block.transform.position = slot1; break; case 2: weaponBlockScript.toggleCount = 3; block.transform.position = slot2; break; case 3: weaponBlockScript.toggleCount = 4; block.transform.position = slot3; break; case 4: weaponBlockScript.toggleCount = 1; StartCoroutine(weaponBlockScript.LockIn()); blockInSlot = block; block.transform.position = hPos; break; } } else if (block.GetComponent<MiniCopterBlock>()){ miniCopterBlock = block.GetComponent<MiniCopterBlock>(); miniCopterBlock.lockedin = false; switch (miniCopterBlock.toggleCount){ case 1: miniCopterBlock.toggleCount = 2; block.transform.position = slot1; break; case 2: miniCopterBlock.toggleCount = 3; block.transform.position = slot2; break; case 3: miniCopterBlock.toggleCount = 4; block.transform.position = slot3; break; case 4: miniCopterBlock.toggleCount = 1; StartCoroutine(miniCopterBlock.LockIn()); blockInSlot = block; block.transform.position = hPos; break; } } } } if (playToggle){ toggleWeapons.Play(); } yield return StartCoroutine (CatalogWeapons ()); }
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 ToggleWeapons() { playToggle = false; yield return(StartCoroutine(CatalogWeapons())); foreach (GameObject block in storedWeapons) { if (block) { playToggle = true; if (block.GetComponent <WeaponBlockScript>()) { weaponBlockScript = block.GetComponent <WeaponBlockScript>(); weaponBlockScript.lockedin = false; switch (weaponBlockScript.toggleCount) { case 1: weaponBlockScript.toggleCount = 2; block.transform.position = slot1; break; case 2: weaponBlockScript.toggleCount = 3; block.transform.position = slot2; break; case 3: weaponBlockScript.toggleCount = 4; block.transform.position = slot3; break; case 4: weaponBlockScript.toggleCount = 1; StartCoroutine(weaponBlockScript.LockIn()); blockInSlot = block; block.transform.position = hPos; break; } } else if (block.GetComponent <MiniCopterBlock>()) { miniCopterBlock = block.GetComponent <MiniCopterBlock>(); miniCopterBlock.lockedin = false; switch (miniCopterBlock.toggleCount) { case 1: miniCopterBlock.toggleCount = 2; block.transform.position = slot1; break; case 2: miniCopterBlock.toggleCount = 3; block.transform.position = slot2; break; case 3: miniCopterBlock.toggleCount = 4; block.transform.position = slot3; break; case 4: miniCopterBlock.toggleCount = 1; StartCoroutine(miniCopterBlock.LockIn()); blockInSlot = block; block.transform.position = hPos; break; } } } } if (playToggle) { toggleWeapons.Play(); } yield return(StartCoroutine(CatalogWeapons())); }
public IEnumerator CatalogWeapons() { blockTypes = new int[] { 0, 0, 0, 0 }; storedWeapons = new GameObject[] { null, null, null, null }; j = 1; numBlocks = 0; while (j < 5) { slotCheck = Physics2D.OverlapCircleAll(character.transform.position, 3f); //Physics2D.OverlapPointNonAlloc(slot,slotCheck); foreach (Collider2D block in slotCheck) { if (block) { if (block.GetComponent <WeaponBlockScript>()) { weaponBlockScript = block.GetComponent <WeaponBlockScript>(); if (weaponBlockScript.wepDSID == wepDSID) { if (weaponBlockScript.toggleCount == j) { blockTypes[j - 1] = weaponBlockScript.blockType; storedWeapons[j - 1] = block.gameObject; numBlocks++; } } } else if (block.GetComponent <MiniCopterBlock>()) { miniCopterBlock = block.GetComponent <MiniCopterBlock>(); if (miniCopterBlock.wepDSID == wepDSID) { if (miniCopterBlock.toggleCount == j) { blockTypes[j - 1] = miniCopterBlock.blockType; storedWeapons[j - 1] = block.gameObject; numBlocks++; } } } } else { blockTypes[j - 1] = -1; storedWeapons[j - 1] = null; } } j++; } StartCoroutine(GravityMonitor()); if (!storedWeapons [0]) { occupied = false; } else { occupied = true; blockInSlot = storedWeapons[0]; } yield return(null); }