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.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 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; } }
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; } }