public void addGun(int gunType) { if (PlayerData.Instance.gunList.Contains(gunType) == false) { PlayerData.Instance.addGun(gunType); } switch (gunType) { case (int)GunPickup.GunType.Pistol: Pistol pistol = new Pistol(this, firePoint, hitEffects[0], gunSounds[0], GetComponent <LineRenderer>(), gunAnimControllers[0], ejected_shell, ejectPt, gunicons[0]); gunList.Add(pistol); break; case (int)GunPickup.GunType.RPG: RPG rpg = new RPG(this, firePoint, hitEffects[0], bulletObjs[1], gunSounds[1], gunAnimControllers[2], gunicons[2]); gunList.Add(rpg); break; case (int)GunPickup.GunType.Shotgun: Shotgun shotgun = new Shotgun(this, firePoint, hitEffects[0], gunSounds[1], bulletObjs[3], gunAnimControllers[1], gunicons[1]); gunList.Add(shotgun); break; case (int)GunPickup.GunType.DualPistols: DualPistols dualPistols = new DualPistols(this, firePoint, DPLeftFirePoint, hitEffects[0], gunSounds[0], GetComponent <LineRenderer>(), dualPistolsLeftFirePoint, gunAnimControllers[3], ejected_shell, ejectPt, gunicons[3]); gunList.Add(dualPistols); break; case (int)GunPickup.GunType.RailGun: RailGun railgun = new RailGun(this, firePoint, hitEffects[0], bulletObjs[4], gunSounds[4], gunAnimControllers[4], gunicons[4]); gunList.Add(railgun); break; case (int)GunPickup.GunType.TVGun: TVGun tvgun = new TVGun(this, firePoint, hitEffects[0], bulletObjs[2], gunSounds[0], gunAnimControllers[5], gunicons[5]); gunList.Add(tvgun); break; case (int)GunPickup.GunType.ColtPython: PythonGun pythonGun = new PythonGun(this, firePoint, hitEffects[0], bulletObjs[5], gunSounds[0], gunAnimControllers[6], gunicons[6]); gunList.Add(pythonGun); break; } if (gunHUDSlots != null) { SetPlayerCurrentGun(currentGun); } playSound(gunSounds[6]); }
void Start() { resetHurtTimer = hurtTimer; CheckpointBox = GameObject.Find("/Player/LookAt/"); WarpPortal.SetActive(false); GameEnd = false; AmmoShot = true; originalPos = camTransform.localPosition; lives = 9; health = 100; SetCountHealth(); SetCountLives(); BossFireBallDam = false; PickupText.text = ""; // Set Timer variables and Speed redScreenFlashTimerStart = redScreenFlashTimer; whiteScreenFlashTimerStart = whiteScreenFlashTimer; FadeTime = 0.0f; FadeSpeed = 1.0f; Lava = false; // Set all guns to be off or on Assault = 1; flak = 1; plasma = 1; rail = 1; rocket = 1; bfgproton = 1; LastCheckPoint = CheckpointBox.transform.position; // Access all weapon scripts PistolScript = GetComponent <Pistol>(); AssaultRifleScript = GetComponent <AssaultRifle>(); FlakCannonScript = GetComponent <FlakCannon>(); PlasmaRifleScript = GetComponent <PlasmaRifle>(); BFGProtonScript = GetComponent <BFGProton>(); RailGunScript = GetComponent <RailGun>(); RocketLauncherScript = GetComponent <RocketLauncher>(); // Set all weapon scripts to true or false ShutOffAllWeapons(); SetupPistol(); }
public Engineer() { _weapon1 = new RailGun(); _weapon2 = new SuperShotgun(); _weapon3 = new Spanner(); _weapon4 = null; _gren1 = Ammunition.FragGrenade; _gren2 = Ammunition.EMPGrenade; _health = 80; _armour = 50; _maxShells = 50; _maxNails = 50; _maxRockets = 50; _maxCells = 200; _maxGren1 = 4; _maxGren2 = 4; }