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.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 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()) { FireBullet(GunPoint, PointerRotation); SPS.playShoot(); AS.ConsumePrimaryAmmo(); CanShoot = false; ShotTimer = 0; StartCoroutine(MultiCast(GunPoint, PointerRotation)); } }
public void Charge(Vector3 GunPoint, Quaternion PointerRotation) { if (CanShoot && AS.CheckCanShootPrimary()) { // code to charge beam, need a new player controller functionallity if (!particlesOBJ.activeSelf) { particlesOBJ.SetActive(true); SPS.PlayLazerCharge(chargeLevel); } particlesOBJ.transform.position = GunPoint; particlesOBJ.transform.rotation = PointerRotation; if (firstPress) { chargeAmount = Time.time; firstPress = false; } if ((Time.time - chargeAmount >= 1 && chargeLevel < 2) || (Time.time - chargeAmount >= 2 && chargeLevel < 3)) { chargeLevel++; SPS.PlayLazerCharge(chargeLevel); Color c = particlesSystem.startColor; c.r += .2f; c.g += .2f; c.b += .2f; c.a = 1; particlesSystem.startColor = c; particlesSystem.Emit(20); particlesSystem.Play(); } if (chargeLevel == 3 && Time.time - chargeAmount > 2) { particlesOBJ.transform.localScale = new Vector2(.5f, .5f); particlesSystem.emissionRate = 40f; } } }
void releaseCharge() { if (CanShoot && AS.CheckCanShootPrimary()) { // change to sword sound SPS.playShoot(); AS.ConsumePrimaryAmmo(); GameObject TmpBullet = Instantiate(projectile, GunPointPerm, RotationPerm) as GameObject; TmpBullet.transform.parent = transform; Material TColor = TmpBullet.GetComponentInChildren <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; CanShoot = false; ShotTimer = 0; ChargeAmount = 0; } }
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; } }