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 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 FireGrenade(Vector3 GunPoint, Quaternion PointerRotation) { GameObject TmpBullet = OPGrenade.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); TmpBullet.GetComponentInChildren <ExplosionScript>().SetBulletNumber(BulletNumber); TmpBullet.GetComponentInChildren <ExplosionScript>().SetOwner(PCS.GetPlayerNum()); Color CtoChange = ES.GetColor(PCS.GetPlayerNum()); CtoChange.r += .2f; CtoChange.g += .2f; CtoChange.b += .2f; TmpBullet.GetComponentInChildren <SpriteRenderer>().color = CtoChange; }
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; } } }