//0 = start (disappear/appear) //1 = still (stay / flash) //2 = shine (sheen) //3 = fire (yellow light) void Awake() { visRad = 2f; shineDelay = 16f * 0.083f; setOffset = .05f; startingHealth = 30; currentHealth = startingHealth; turretGun = transform.FindChild("Turret_Gun").gameObject; turretGun.SetActive(false); weaponBlockScript = GetComponent <WeaponBlockScript> (); blockAnimator = GetComponent <Animator> (); gunAnimator = turretGun.GetComponent <Animator> (); boxCol = GetComponent <BoxCollider2D> (); newBoxCenter1 = new Vector2(0.05f, -.055f); newBoxCenter2 = new Vector2(0f, 0.04f); done = false; delayShoot = 2f; blockAnimator.SetInteger("AnimState", -1); fireForce = 35f; burstCount = 10; timebtShots = .15f; bulletCount = 40; maxInt = 5; tipTran = transform.FindChild("TurretTip"); barrelTran = transform.FindChild("TurretBarrel"); bulletPath = "Prefabs/EnemyProjectiles/Tur_Stan_Bullet"; }
// Use this for initialization void Awake() { startingHealth = 50; currentHealth = startingHealth; pushOutForce = 5000f; projectionTol = 0.9f; orbitDists = new float[] { .7f, 1.1f, 1.5f, 1.9f }; loseRadii = new float[] { 0f, 0f, 0f, 0f }; orbitSpeeds = new float[] { 0f, 0f, 0f, 0f }; l = 0; foreach (float o in orbitDists) { loseRadii[l] = o * 3f; orbitSpeeds[l] = 1 / o; l++; } running = false; merging = false; maxVelocity = 4f; reverseVel = .1f; weaponBlockScript = GetComponent <WeaponBlockScript> (); maxFloatVelocity = new Vector2(3f, 3f); holdCount = 0; brakeForce = 1500f; pullInForce = 5000f; orbiting = false; GameObject.Find("theOmniscient").GetComponent <GatherAllKnowledge> ().numTelekinetic++; }
//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 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); }
// Use this for initialization void Awake() { weaponBlockScript = GetComponent<WeaponBlockScript> (); activationDelay = .5f; shockAnimator = GetComponent<Animator> (); shockAnimator.SetInteger ("AnimState", 0); shockRadius = .75f; stickerShock = 4; disintegrateTime = 2f; j = 0; }
// Use this for initialization void Awake() { weaponBlockScript = GetComponent <WeaponBlockScript> (); activationDelay = .5f; shockAnimator = GetComponent <Animator> (); shockAnimator.SetInteger("AnimState", 0); shockRadius = .75f; stickerShock = 4; disintegrateTime = 2f; j = 0; }
void OnTriggerStay2D(Collider2D block) { if (attract && block.GetComponent<WeaponBlockScript>()){ weaponBlockScript = block.GetComponent<WeaponBlockScript>(); if (weaponBlockScript.toggleCount<1 && !weaponBlockScript.nowProjectile){ aDir = Vector3.Normalize(weaponDetectorTransform.position - block.transform.position); dist = Vector3.Distance(weaponDetectorTransform.position,block.transform.position); pullForce = Mathf.Exp(-dist) * pullForceBaseline; block.rigidbody2D.AddForce(aDir*pullForce*Time.deltaTime); } } }
// Use this for initialization void Awake() { weaponBlockScript = GetComponent<WeaponBlockScript> (); boxCols = GetComponents<BoxCollider2D> (); frozen = false; freezeTime = 11f; dropTime = 2.5f; iceOffset = .08f; icecleOffset = -.17f; icecleDamage = 20; freezeBlockString = "Prefabs/WeaponBlocks/FreezeBlock"; boxCols [0].enabled = true; boxCols [1].enabled = false; }
void OnTriggerStay2D(Collider2D block) { if (attract && block.GetComponent <WeaponBlockScript>()) { weaponBlockScript = block.GetComponent <WeaponBlockScript>(); if (weaponBlockScript.toggleCount < 1 && !weaponBlockScript.nowProjectile) { aDir = Vector3.Normalize(weaponDetectorTransform.position - block.transform.position); dist = Vector3.Distance(weaponDetectorTransform.position, block.transform.position); pullForce = Mathf.Exp(-dist) * pullForceBaseline; block.rigidbody2D.AddForce(aDir * pullForce * Time.deltaTime); } } }
// Use this for initialization void Awake() { weaponBlockScript = GetComponent <WeaponBlockScript> (); boxCols = GetComponents <BoxCollider2D> (); frozen = false; freezeTime = 11f; dropTime = 2.5f; iceOffset = .08f; icecleOffset = -.17f; icecleDamage = 20; freezeBlockString = "Prefabs/WeaponBlocks/FreezeBlock"; boxCols [0].enabled = true; boxCols [1].enabled = false; }
void Awake() { weaponBlockScript = GetComponent <WeaponBlockScript> (); pulRadius = 7f; exRadius = 7f; pullSecs = 1.5f; pullForce = 600f; exForceBaseline = 1500f; damageBaseline = 20f; getCozy = false; dontPullStrings = new string[] { "Floor", "Wall", "Arm1", "WeaponDetector1", "Arm2", "WeaponDetector2", "TractorBeam1", "TractorBeam2", "Shield1", "Shield2" }; //gameobject names dontBlowStrings = new string[] { "Floor", "Wall", "Arm1", "WeaponDetector1", "Arm2", "WeaponDetector2", "TractorBeam1", "TractorBeam2", "Shield1", "Shield2" }; //gameobject names weaponStrings = new string[] { "SuperNeutral", "SuperExploder", "Neutral", "Exploder", "Frozesploder", "MiniCopter", "Telekinetic" }; //gameobject tags }
//private Animator animator; void Awake() { damageBaseline = 35; materialCache = new Dictionary <float, PhysicsMaterial2D>(); weaponBlockScript = GetComponent <WeaponBlockScript> (); isFrozen = false; timeFrozen = 2f; freezeTimer = 0f; iceSheetOffset = .0325f; timer = .1f; nowProjectile = false; exRadius = 7f; i = 0; first = true; icecle = false; itsAPlayer = false; }
void Awake() { weaponBlockScript = GetComponent <WeaponBlockScript> (); blows = 0; i = 0; j = 0; exRadius = 7f; time2Blow = 1f; play = true; horny = true; this.enabled = true; exForceBaseline = 900f; damageBaseline = 20f; dontBlowStrings = new string[] { "Arm1", "Arm2", "WeaponDetector1", "WeaponDetector2", "TractorBeam1", "TractorBeam2", "Shield1", "Shield2" }; }
public IEnumerator CombineWeapons() { if (combinator) { yield return(StartCoroutine(CatalogWeapons())); if (blockTypes[1] == blockTypes[2] && blockTypes[1] == blockTypes[3] && (blockTypes[1] == 1 || blockTypes[1] == 2 || blockTypes[1] == 3 || blockTypes[1] == 7 || blockTypes[1] == 11)) { if (occupied) { slotSpot4SuperBlock = slot3; //Check me for changes to slot Spots and slots and so on lockstatus = false; slotNum = 4; } else { slotSpot4SuperBlock = hPos; lockstatus = true; slotNum = 1; } switch (blockTypes[1]) { case 1: superBlockPath = superNeutralBlockPath; break; case 2: superBlockPath = superExplosiveBlockPath; break; case 3: superBlockPath = superFrozesplosiveBlockPath; break; case 7: superBlockPath = superTelekineticBlockPath; break; case 11: superBlockPath = superTurretBlockPath; break; } superBlock = Instantiate(Resources.Load(superBlockPath), slotSpot4SuperBlock, Quaternion.identity) as GameObject; weaponBlockScript = superBlock.GetComponent <WeaponBlockScript>(); weaponBlockScript.wepDSID = wepDSID; weaponBlockScript.toggleCount = slotNum; if (lockstatus) { StartCoroutine(weaponBlockScript.LockIn()); } superBlock.collider2D.isTrigger = true; i = 1; while (i < storedWeapons.Length) { Destroy(storedWeapons[i]); i++; } } } 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); } } }
// Use this for initialization void Awake() { timeCheck = new float[]{Time.realtimeSinceStartup,0}; //reset to try again timeInt=0; maxVelocity = 3f; brakeForce = 2000f; holdAwayRadius = 1f; aimTol = 0.1f; rotoSpeed = 2f; corRotoSpeed = 1f; maxAway = 3f; minAway = 0.2f; angleTol = 3f; triggerDelay = 0.5f; timeInt = 0; i = 0; timeCheck = new float[]{0,0}; rotating = false; recovering = false; pushing = false; teleHovering = false; startingHealth = 50; currentHealth = startingHealth; liftForce = 75f; recoRotoSpeed = 25f; angleTol = 3f; weaponBlockScript = GetComponent<WeaponBlockScript> (); angleTol1 = 5f; angleTol2 = 3f; maxFloatVelocity = new Vector2 (3f, 3f); floatingSpeed = 200f; exRadius = 7f; playerPullForce = 3000f; exForceBaseline = 300f; separationDist = .3f; maxPlayerVelocity = 7f; playerBrakeForce = 2500f; //holding out brakeForce = 1000f; brakeTorque = 5000f; pullInForce = 7500f; startingHoldAwayRadius = 1f; holdAwayRadius = startingHoldAwayRadius; loseRadius = 6f; hoverLoseRadius = .2f; holdCount = 0; playerHeight = .43f; stickHeight = 0.55f; side = 0; //1=top, 2=right, 3=bottom, 4=left maxVelocity = 3f; magneto = true; teleHovering = false; rotating = false; flattening = false; orbiting = false; flat = false; dontBlowStrings = new string[] {"TestPlatform","Arm1","WeaponDetector1","Arm2","WeaponDetector2","TractorBeam1","TractorBeam2","Shield1","Shield2"}; weaponStrings = new string[] {"SuperNeutral","SuperExploder","Neutral","Exploder","Frozesploder","MiniCopter","Telekinetic"}; GameObject.Find ("theOmniscient").GetComponent<GatherAllKnowledge> ().numTelekinetic ++; }
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())); }
//private Animator animator; void Awake() { damageBaseline = 35; materialCache = new Dictionary<float,PhysicsMaterial2D>(); weaponBlockScript = GetComponent<WeaponBlockScript> (); isFrozen = false; timeFrozen = 2f; freezeTimer = 0f; iceSheetOffset = .0325f; timer = .1f; nowProjectile = false; exRadius = 7f; i = 0; first = true; icecle = false; itsAPlayer = false; }
void Awake() { weaponBlockScript = GetComponent<WeaponBlockScript> (); blows = 0; i = 0; j = 0; exRadius = 7f; time2Blow = 1f; play = true; horny = true; this.enabled = true; exForceBaseline = 900f; damageBaseline = 20f; dontBlowStrings = new string[] { "Arm1", "Arm2", "WeaponDetector1", "WeaponDetector2", "TractorBeam1", "TractorBeam2", "Shield1", "Shield2" }; }
// Use this for initialization void Awake() { timeCheck = new float[] { Time.realtimeSinceStartup, 0 }; //reset to try again timeInt = 0; maxVelocity = 3f; brakeForce = 2000f; holdAwayRadius = 1f; aimTol = 0.1f; rotoSpeed = 2f; corRotoSpeed = 1f; maxAway = 3f; minAway = 0.2f; angleTol = 3f; triggerDelay = 0.5f; timeInt = 0; i = 0; timeCheck = new float[] { 0, 0 }; rotating = false; recovering = false; pushing = false; teleHovering = false; startingHealth = 50; currentHealth = startingHealth; liftForce = 75f; recoRotoSpeed = 25f; angleTol = 3f; weaponBlockScript = GetComponent <WeaponBlockScript> (); angleTol1 = 5f; angleTol2 = 3f; maxFloatVelocity = new Vector2(3f, 3f); floatingSpeed = 200f; exRadius = 7f; playerPullForce = 3000f; exForceBaseline = 300f; separationDist = .3f; maxPlayerVelocity = 7f; playerBrakeForce = 2500f; //holding out brakeForce = 1000f; brakeTorque = 5000f; pullInForce = 7500f; startingHoldAwayRadius = 1f; holdAwayRadius = startingHoldAwayRadius; loseRadius = 6f; hoverLoseRadius = .2f; holdCount = 0; playerHeight = .43f; stickHeight = 0.55f; side = 0; //1=top, 2=right, 3=bottom, 4=left maxVelocity = 3f; magneto = true; teleHovering = false; rotating = false; flattening = false; orbiting = false; flat = false; dontBlowStrings = new string[] { "TestPlatform", "Arm1", "WeaponDetector1", "Arm2", "WeaponDetector2", "TractorBeam1", "TractorBeam2", "Shield1", "Shield2" }; weaponStrings = new string[] { "SuperNeutral", "SuperExploder", "Neutral", "Exploder", "Frozesploder", "MiniCopter", "Telekinetic" }; GameObject.Find("theOmniscient").GetComponent <GatherAllKnowledge> ().numTelekinetic++; }
public IEnumerator CombineWeapons() { if (combinator){ yield return StartCoroutine (CatalogWeapons ()); if (blockTypes[1] == blockTypes[2] && blockTypes[1] == blockTypes[3] && (blockTypes[1] == 1 || blockTypes[1] ==2 || blockTypes[1] ==3 || blockTypes[1] == 7 || blockTypes[1] == 11)){ if (occupied){ slotSpot4SuperBlock = slot3; //Check me for changes to slot Spots and slots and so on lockstatus = false; slotNum = 4; } else{ slotSpot4SuperBlock = hPos; lockstatus = true; slotNum = 1; } switch (blockTypes[1]){ case 1: superBlockPath = superNeutralBlockPath; break; case 2: superBlockPath = superExplosiveBlockPath; break; case 3: superBlockPath = superFrozesplosiveBlockPath; break; case 7: superBlockPath = superTelekineticBlockPath; break; case 11: superBlockPath = superTurretBlockPath; break; } superBlock = Instantiate ( Resources.Load (superBlockPath),slotSpot4SuperBlock,Quaternion.identity) as GameObject; weaponBlockScript = superBlock.GetComponent<WeaponBlockScript>(); weaponBlockScript.wepDSID = wepDSID; weaponBlockScript.toggleCount = slotNum; if (lockstatus){ StartCoroutine(weaponBlockScript.LockIn()); } superBlock.collider2D.isTrigger = true; i=1; while ( i<storedWeapons.Length ){ Destroy (storedWeapons[i]); i++; } } } yield return StartCoroutine (CatalogWeapons ()); }
//0 = start (disappear/appear) //1 = still (stay / flash) //2 = shine (sheen) //3 = fire (yellow light) void Awake() { visRad = 2f; shineDelay = 16f * 0.083f; setOffset = .05f; startingHealth = 30; currentHealth = startingHealth; turretGun = transform.FindChild ("Turret_Gun").gameObject; turretGun.SetActive(false); weaponBlockScript = GetComponent<WeaponBlockScript> (); blockAnimator = GetComponent<Animator> (); gunAnimator = turretGun.GetComponent<Animator> (); boxCol = GetComponent<BoxCollider2D> (); newBoxCenter1 = new Vector2 (0.05f, -.055f); newBoxCenter2 = new Vector2 (0f, 0.04f); done = false; delayShoot = 2f; blockAnimator.SetInteger ("AnimState", -1); fireForce = 35f; burstCount = 10; timebtShots = .15f; bulletCount = 40; maxInt = 5; tipTran = transform.FindChild ("TurretTip"); barrelTran = transform.FindChild ("TurretBarrel"); bulletPath = "Prefabs/EnemyProjectiles/Tur_Stan_Bullet"; }
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); }