public void RefillAmmo(GunHandling g) { if (id != g.currentWeapon && id != g.sideWeapon) { return; } g.addPoints(-refillPrice); g.refillAmmo(id == g.currentWeapon); }
// Use this for initialization void Start() { animator = GetComponentInParent <Animator> (); mainCamera = GetComponentInParent <Camera> (); muzzleFlash = GetComponentInChildren <ParticleSystem> (); reserveAmmo = maxReserveAmmo; clipAmmo = clipSize; gh = GetComponentInParent <GunHandling> (); ammoText = GameObject.Find("Ammo").GetComponent <Text> (); }
void OnTriggerExit(Collider other) { GunHandling g = other.GetComponentInChildren <GunHandling> (); if (g != null) { g.buyer = null; buyText.text = ""; } }
public void Die() { isDead = true; agent.Stop(); GunHandling g = target.GetComponentInChildren <GunHandling> (); if (g != null) { g.addPoints(100); } }
public void action(GunHandling g) { if (g.currentWeapon == id || g.sideWeapon == id) { if (g.getScore() < refillPrice) { return; } RefillAmmo(g); return; } if (g.getScore() < price) { return; } Replace(g); }
void OnTriggerEnter(Collider other) { GunHandling g = other.GetComponentInChildren <GunHandling> (); if (g != null) { g.buyer = this; if (id == g.currentWeapon || id == g.sideWeapon) { buyText.text = "Press B to buy ammo for " + name + " at " + refillPrice; } else { buyText.text = "Press B to buy " + name + " for " + price; } } }
public void Replace(GunHandling g) { g.addPoints(-price); g.setCurrent(id); }