public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootPrimary()) { SPS.PlayBoomerang(); AS.ConsumePrimaryAmmoNoReload(); GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = GunPoint; TmpBullet.SetActive(true); TmpBullet.GetComponent <ProjectileScript>().setPlayerReturn(transform); Component[] TrailArray; TrailArray = TmpBullet.GetComponentsInChildren <TrailRenderer> (); foreach (TrailRenderer Current in TrailArray) { Material TColor = Current.material; TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum())); } TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber); BulletNumber++; Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; CanShoot = false; ShotTimer = 0; } }
public void Detonate() { Quaternion PointerRotation = Quaternion.identity; SPS.playExplosion(); for (int i = 0; i < 20; i++) { GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, transform.position, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = transform.position; GameObject TmpTrail = OPTrail.FetchObject(); //Instantiate (Trail, transform.position, PointerRotation) as GameObject; TmpTrail.GetComponent <TrailFollowScript> ().SetThingToFollow(TmpBullet.transform); Material TColor = TmpTrail.GetComponent <TrailRenderer> ().material; TColor.SetColor("_Color", ES.GetColor(PlayerNum)); TmpBullet.layer = 17 + PlayerNum; Color CtoChange = ES.GetColor(PlayerNum); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; PointerRotation = PointerRotation * Quaternion.Euler(0, 0, 18); //TmpBullet.GetComponent<ProjectileScript>().Speed = pSpeed; TmpBullet.SetActive(true); TmpTrail.SetActive(true); TmpBullet.GetComponentInChildren <HitScript> ().SetOwner(PlayerNum); TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber); TmpBullet.GetComponentInChildren <SpriteRenderer> ().color = CtoChange; } gameObject.SetActive(false); }
void FireBullet(Vector3 GunPoint, Quaternion PointerRotation) { GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = GunPoint; TmpBullet.SetActive(true); GameObject TmpTrail = OPTrail.FetchObject(); //Instantiate (Trail, GunPoint, PointerRotation) as GameObject; TmpTrail.SetActive(true); TmpTrail.GetComponent <TrailFollowScript>().SetThingToFollow(TmpBullet.transform); Material TColor = TmpTrail.GetComponent <TrailRenderer>().material; TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum())); TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber); Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootPrimary()) { SPS.PlayBoomerang(); AS.ConsumePrimaryAmmo(false); GameObject TmpBullet = OPProjectile.FetchObject(); TmpBullet.transform.position = GunPoint; TmpBullet.transform.rotation = PointerRotation; TmpBullet.SetActive(true); Material TColor = TmpBullet.GetComponentInChildren <TrailRenderer>().material; TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber); BulletNumber++; Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); Component[] sprites = TmpBullet.GetComponentsInChildren <SpriteRenderer>(); foreach (SpriteRenderer s in sprites) { s.color = CtoChange; CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; } TColor.SetColor("_Color", CtoChange); CanShoot = false; ShotTimer = 0; } }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootPrimary()) { SPS.playShoot(); AS.ConsumePrimaryAmmo(); GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = GunPoint; GameObject TmpTrail = OPTrail.FetchObject(); //Instantiate (Trail, GunPoint, PointerRotation) as GameObject; TmpTrail.SetActive(true); TmpBullet.SetActive(true); TmpTrail.GetComponent <TrailFollowScript>().SetThingToFollow(TmpBullet.transform); Material TColor = TmpTrail.GetComponent <TrailRenderer>().material; TColor.SetColor("_Color", ES.GetColor(PCS.GetPlayerNum())); TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <HitScript>().SetBulletNumber(BulletNumber); TmpBullet.GetComponentInChildren <ExplosionScript>().SetBulletNumber(BulletNumber); BulletNumber++; TmpBullet.GetComponentInChildren <ExplosionScript>().SetOwner(PCS.GetPlayerNum()); CanShoot = false; ShotTimer = 0; } }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootSecondary()) { int Layer = 1 << 9; RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.up, Mathf.Infinity, Layer); if (hit.collider != null && (hit.collider.tag == "Wall" || hit.collider.tag == "MovingWall") && hit.distance < .5f) { SPS.playGrenadeToss(); AS.ConsumeSecondaryAmmo(); GameObject TmpBullet = OPProjectile.FetchObject(); TmpBullet.transform.position = hit.point; Debug.Log(hit.normal); Debug.Log(Mathf.Atan2(hit.normal.x, hit.normal.y) * Mathf.Rad2Deg); TmpBullet.transform.rotation = Quaternion.identity; TmpBullet.transform.rotation = Quaternion.FromToRotation(TmpBullet.transform.up, hit.normal); TmpBullet.SetActive(true); TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; TmpBullet.GetComponent <TripMineLineScript>().SetColors(CtoChange); TmpBullet.GetComponentInChildren <ExplosionScript>().SetOwner(PCS.GetPlayerNum()); CanShoot = false; ShotTimer = 0; TmpBullet.transform.parent = hit.collider.transform; } } }
void ShootSingleParticle() { GameObject tmp = BloodPool.FetchObject(); tmp.transform.position = transform.position; tmp.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 365)); tmp.GetComponent <SpriteRenderer> ().color = new Color(Random.Range(.3f, .7f), 0, 0, 1); tmp.transform.localScale = new Vector3(Random.Range(.05f, .2f), Random.Range(.05f, .2f), 1); tmp.SetActive(true); tmp.GetComponent <Rigidbody2D> ().velocity = new Vector3(Random.Range(-3, 3), Random.Range(0, 5), 0); }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootSecondary()) { SPS.playGrenadeToss(); POutline.SetActive(false); GameObject TMP = OPWall.FetchObject(); TMP.transform.position = GunPoint; TMP.transform.rotation = PointerRotation; TMP.GetComponent <SpriteRenderer>().color = ES.GetColor(PCS.GetPlayerNum()); TMP.SetActive(true); AS.ConsumeSecondaryAmmo(); } }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootSecondary()) { SPS.playGrenadeToss(); AS.ConsumeSecondaryAmmo(); GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = new Vector3(transform.position.x, transform.position.y, -5); TmpBullet.SetActive(true); CanShoot = false; ShotTimer = 0; } }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootSecondary()) { SPS.playInterceptor(); AS.ConsumeSecondaryAmmo(); GameObject TMP = OP.FetchObject(); TMP.transform.position = transform.position; TMP.transform.rotation = transform.rotation; TMP.SetActive(true); CanShoot = false; ShotTimer = 0; } }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootPrimary()) { Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .025f; CtoChange.g += .025f; CtoChange.b += .025f; AS.ConsumePrimaryAmmo(); GameObject TmpBullet = OPProjectile.FetchObject(); TmpBullet.GetComponent <LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, transform.up, PCS.GetPlayerNum(), BulletNumber); //if (chargeLevel > 2){ // diff = new Vector2( hit2.point.x - hit.point.x, hit2.point.y - hit.point.y); // hit3 = Physics2D.Raycast (hit2.point, Vector3.Reflect(diff.normalized, hit2.normal), Mathf.Infinity, Layer); // TmpBullet.GetComponent<LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, hit.point, hit2.point, hit3.point); // }else{ // TmpBullet.GetComponent<LazerProjectileScript>().ShootLine(chargeLevel, CtoChange, transform.position, hit.point, hit2.point); // } //TmpBullet.SetActive(true); //TmpBullet.layer = 17 + PCS.GetPlayerNum(); //TmpBullet.GetComponent<HitScript>().BulletDamage = chargeLevel; //TmpBullet.GetComponent<HitScript>().SetBulletNumber(BulletNumber); BulletNumber++; //TmpBullet.GetComponent<HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <LineRenderer>().SetColors(CtoChange, CtoChange); SPS.PlayLazerShoot(); CanShoot = false; ShotTimer = 0; chargeLevel = 1; chargeAmount = 0; particlesSystem.startColor = ES.GetColor(PCS.GetPlayerNum()); particlesOBJ.transform.localScale = new Vector2(1f, 1f); particlesSystem.emissionRate = 25f; particlesOBJ.SetActive(false); firstPress = true; } }
IEnumerator SparksAnim(int amount) { for (int x = 0; x < amount; x++) { for (int i = 0; i < 3; i++) { GameObject tmp = SparksScript.FetchObject(); tmp.transform.position = transform.position; tmp.transform.eulerAngles = new Vector3(0, 0, Random.Range(0, 365)); tmp.GetComponent <SpriteRenderer> ().color = new Color(1, Random.Range(.6f, .9f), .3f, 1); tmp.transform.localScale = new Vector3(Random.Range(.05f, .15f), Random.Range(.05f, .15f), 1); tmp.SetActive(true); tmp.GetComponent <Rigidbody2D> ().velocity = new Vector3(Random.Range(-1.5f, 1.5f), Random.Range(0, 1), 0); } yield return(null); } }
void FixedUpdate() { if (delayCount < 0) { delayCount = delay; GameObject temp = pool.FetchObject(); temp.GetComponent <Transform>().position = GetComponent <Transform>().position; temp.GetComponent <Enemy>().setHealth(health); temp.SetActive(true); spawnNumber--; if (spawnNumber < 0) { spawnNumber = 5; gameObject.SetActive(false); } } delayCount--; }
public void Shoot(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && numOfMines > 2) { for (int x = 0; x < numOfMines; x++) { mines[x].GetComponent <SachelExplosionScript>().Detonate(); } numOfMines = 0; } else if (CanShoot && AS.CheckCanShootPrimary()) { SPS.playGrenadeToss(); AS.ConsumePrimaryAmmo(); GameObject TmpBullet = OPProjectile.FetchObject(); //= Instantiate (projectile, GunPoint, PointerRotation) as GameObject; TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = GunPoint; TmpBullet.SetActive(true); TmpBullet.layer = 17 + PCS.GetPlayerNum(); TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; TmpBullet.GetComponentInChildren <HitScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <SachelExplosionScript>().SetOwner(PCS.GetPlayerNum()); TmpBullet.GetComponentInChildren <SachelExplosionScript>().SetBulletNumber(BulletNumber); BulletNumber++; CanShoot = false; mines[numOfMines] = TmpBullet; numOfMines++; ShotTimer = 0; } }
void OnDisable() { if (first) { first = false; } else { Quaternion PointerRotation = Quaternion.identity; SPS.playExplosion(); for (int i = 0; i < 20; i++) { GameObject TmpBullet = OPProjectile.FetchObject(); TmpBullet.transform.rotation = PointerRotation; TmpBullet.transform.position = transform.position; GameObject TmpTrail = OPTrail.FetchObject(); TmpTrail.GetComponent <TrailFollowScript> ().SetThingToFollow(TmpBullet.transform); Material TColor = TmpTrail.GetComponent <TrailRenderer> ().material; TColor.SetColor("_Color", ES.GetColor(PlayerNum)); TmpBullet.layer = 17 + PlayerNum; Color CtoChange = ES.GetColor(PlayerNum); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; PointerRotation = PointerRotation * Quaternion.Euler(0, 0, 18); TmpBullet.SetActive(true); TmpTrail.SetActive(true); TmpBullet.GetComponentInChildren <HitScript> ().SetOwner(PlayerNum); TmpBullet.GetComponentInChildren <HitScript> ().SetBulletNumber(BulletNumber); TmpBullet.GetComponentInChildren <SpriteRenderer> ().color = CtoChange; } } }
public void nextLevel() { lvl++; if (lvl % 200 != 0) { //gens spawns for (int i = 0; i < lvl; i++) { GameObject sp = poolS.FetchObject(); sp.GetComponent <Transform>().position = new Vector3(((((Random.value * 100) % 16) - 8.1f) + Random.value), ((((Random.value * 100) % 8) - 4f) + Random.value), 0); sp.GetComponent <SpawnerScript>().setSpawnNumber((int)Mathf.Sqrt(lvl), lvl * 50); } //gen boxes for (int i = 0; i < 10; i++) { poolc.FetchObject().GetComponent <Transform>().position = new Vector3(((((Random.value * 100) % 16) - 8.1f) + Random.value), ((((Random.value * 100) % 8) - 4f) + Random.value), 0); } } else { //boss fight } }
// shoots out a single particle according to the paramters set in the class void EmitSingleParticle(float forceRatio = 1, float scaleRatio = 1) { // get particle from pool GameObject tmp = particlePool.FetchObject(); Color tmpC = Color.white; // put particle on systems position or in a random area around it if (useRandomPosition) { Vector3 tmpPos = transform.position; tmpPos.x += Random.Range(positionMin.x, positionMax.x); tmpPos.y += Random.Range(positionMin.y, positionMax.y); tmp.transform.position = tmpPos; } else { tmp.transform.position = transform.position; } // handle particle rotation if (useRandomRotation) { tmp.transform.eulerAngles = new Vector3(0, 0, Random.Range(rotationMin, rotationMax)); } // handle color if (useRandomColor) { tmpC = RandomBetweenTwoColors(); } // handle scale if (useRandomScale) { tmp.transform.localScale = new Vector3(Random.Range(scaleMin.x * scaleRatio, scaleMax.x * scaleRatio), Random.Range(scaleMin.y * scaleRatio, scaleMax.y * scaleRatio), 1); } else { tmp.transform.localScale = Vector3.one; } // set object active tmp.SetActive(true); // handle particle forces Vector3 tmpForce = Vector3.zero; if (useForces) { if (tmp.GetComponent <Rigidbody2D> () != null) { tmp.GetComponent <Rigidbody2D> ().velocity = new Vector3(Random.Range(forceMin.x * forceRatio, forceMax.x * forceRatio), Random.Range(forceMin.y * forceRatio, forceMax.y * forceRatio), 0); } else { tmpForce = new Vector3(Random.Range(forceMin.x * forceRatio, forceMax.x * forceRatio), Random.Range(forceMin.y * forceRatio, forceMax.y * forceRatio), 0); } } if (tmp.GetComponent <ParticleScript> () != null) { tmp.GetComponent <ParticleScript> ().InitialSetup(particleLifetime, tmpForce, tmpC, useScaleOverTime, scaleModifier, useSimulatedGravity, gravitySpeed); } }
void AnimateLineBreak(bool forceAnimation = false, bool usePosition = false, Vector3 cutPosition = default(Vector3), Vector3 newPosition = default(Vector3)) { if (chainAnimAllowed || forceAnimation) { SPS.PlayChainBreak(); chainAnimAllowed = false; float x = 0; Vector2 diff = transform.position - new Vector3(swingPoint.x, swingPoint.y, 0); Quaternion rot = Quaternion.Euler(0, 0, 180 - Mathf.Atan2(diff.x, diff.y) * Mathf.Rad2Deg); Rigidbody2D lastLink = null; bool first = true; float cutPoint = 0; if (usePosition) { cutPoint = Vector3.Distance(swingPoint, cutPosition); } float lineLength = Vector2.Distance(transform.position, swingPoint); if (newPosition != Vector3.zero) { lineLength -= Vector2.Distance(transform.position, newPosition); } while (x < lineLength) { GameObject tmp = chainLinkPool.FetchObject(); tmp.transform.position = Vector3.MoveTowards(swingPoint, transform.position, x); tmp.transform.position = new Vector3(tmp.transform.position.x, tmp.transform.position.y, 10); tmp.transform.rotation = rot; if (!useLightweightLink) { tmp.GetComponent <HingeJoint2D> ().connectedBody = null; tmp.GetComponent <HingeJoint2D> ().enabled = true; if (first) { tmp.SetActive(true); tmp.GetComponent <SelfTurnOffScript> ().StartCountdown(); first = false; } else if (lastLink != null) { if (usePosition && Mathf.Abs(x - cutPoint) < 1f) { Debug.Log("break"); tmp.GetComponent <HingeJoint2D> ().enabled = false; tmp.SetActive(true); tmp.GetComponent <Rigidbody2D> ().velocity = new Vector3(Random.Range(-1f, 1f), Random.Range(1f, 3f), 0); } else { tmp.GetComponent <HingeJoint2D> ().connectedBody = lastLink; tmp.SetActive(true); } tmp.GetComponent <SelfTurnOffScript> ().StartCountdown(3); } //tmp.GetComponent<Rigidbody2D> ().velocity = new Vector3 (Random.Range (-1f, 1f), Random.Range (1f, 3f), 0); x += .9f; lastLink = tmp.GetComponent <Rigidbody2D> (); } else { tmp.SetActive(true); tmp.GetComponent <ParticleScript> ().InitialSetup(2f, new Vector3(Random.Range(-.01f, .01f), 0, 0), Color.white, false, Vector3.zero, true, .01f); x += .5f; } } StartCoroutine(chainAnimTimer()); } }
//called on an interval void FixedUpdate() { state = GamePad.GetState((GamePad.Index)conNum); fullBodyPosition = new Vector3((speed * (state.LeftStickAxis [0] + moveLR)) + gameObject.GetComponent <Transform> ().position.x, (speed * (state.LeftStickAxis [1] + moveUD)) + gameObject.GetComponent <Transform> ().position.y, 0); //wepon/////////////////////////////////////////////////////////////////// if (fireType == 1) { if (gunCool < 0 && attGo) { gunCool = gunCycle; GameObject tempLaser = GameObject.Find("PoolLasers").GetComponent <ObjectPoolScript> ().FetchObject(); tempLaser.GetComponent <Transform> ().position = fullBodyPosition; tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); } } else if (fireType == 2) { if (gunCool < 0 && attGo) { gunCool = gunCycle; if (attdir.x == 1 || attdir.x == -1) { GameObject tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y + .3f, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y - .3f, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); } else { GameObject tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x + .3f, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x - .3f, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); } } } else if (fireType == 3) { if (gunCool < 0 && attGo) { gunCool = gunCycle; if (attdir.x == 1 || attdir.x == -1) { GameObject tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y + .1f, 0); tempLaser.GetComponent <lazer> ().dir(new Vector3(attdir.x, attdir.y + .2f, 0), range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y - .1f, 0); tempLaser.GetComponent <lazer> ().dir(new Vector3(attdir.x, attdir.y - .2f, 0), range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); } else { GameObject tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x + .1f, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(new Vector3(attdir.x + .2f, attdir.y, 0), range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x - .1f, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(new Vector3(attdir.x - .2f, attdir.y, 0), range, pir); tempLaser = Laser.FetchObject(); tempLaser.GetComponent <Transform>().position = new Vector3(fullBodyPosition.x, fullBodyPosition.y, 0); tempLaser.GetComponent <lazer> ().dir(attdir, range, pir); } } } gunCool--; if (dmgon) { dmgCool--; if (dmgCool < 0) { dmgCool = 50; health--; } } dmgCool--; full.position = fullBodyPosition; }