// [HideInInspector] // public AmmoGUI gui; void Start() { muzzleflash = GetComponent<MuzzleFlash>(); ammoVariables = GameObject.FindWithTag ("Player").GetComponent<AmmunitionVariables>(); shotsRemainingInBurst = burstCount; //Restock(); // currentAmmoInMag = ammoPerMag; // if (gui) { // gui.SetAmmoInfo(totalAmmo, currentAmmoInMag); // } SetAmmoVariables(); }
// [HideInInspector] // public AmmoGUI gui; void Start() { muzzleflash = GetComponent<MuzzleFlash>(); ammoVariables = GameObject.FindGameObjectWithTag ("Player").GetComponent<AmmunitionVariables>(); shotsRemainingInBurst = burstCount; alienScream = Resources.Load ("alien-scream") as AudioClip; ammoText = GameObject.FindGameObjectWithTag("AmmoText").GetComponent<Text>() as Text; //Restock(); // currentAmmoInMag = ammoPerMag; // if (gui) { // gui.SetAmmoInfo(totalAmmo, currentAmmoInMag); // } if(gameObject.tag == "Revolver") { currentAmmo = ammoVariables.revolverCurrentAmmo; currentClip = ammoVariables.revolverCurrentClip; maxAmmo = ammoVariables.revolverMaxAmmo; maxClip = ammoVariables.revolverMaxClip; } else if(gameObject.tag == "Rifle") { currentAmmo = ammoVariables.rifleCurrentAmmo; currentClip = ammoVariables.rifleCurrentClip; maxAmmo = ammoVariables.rifleMaxAmmo; maxClip = ammoVariables.rifleMaxClip; } else if(gameObject.tag == "Shotgun") { currentAmmo = ammoVariables.shotgunCurrentAmmo; currentClip = ammoVariables.shotgunCurrentClip; maxAmmo = ammoVariables.shotgunMaxAmmo; maxClip = ammoVariables.shotgunMaxClip; } }
//PlayerController otherPlayerScript; // Use this for initialization void Start() { alive = true; windowRect = new Rect(Screen.width/2-200, Screen.height/2-100, 400,200); // Storing the Y position of the health bar. cachedHealthY = healthTransform.position.y; cachedOxygenY = oxygenTransform.position.y; // Storing the X value of the bar at max health, which is the starting position of the bar. maxHealthXValue = healthTransform.position.x; maxOxygenXValue = oxygenTransform.position.x; // The x position of the bar at minimum health is the starting position of the bar minus the width of the rectangle (the health bar). minHealthXValue = healthTransform.position.x - healthTransform.rect.width; minOxygenXValue = oxygenTransform.position.x - oxygenTransform.rect.width; currentHealth = maxHealth; currentOxygen = maxOxygen; cashText = GameObject.FindGameObjectWithTag("SpaceCash").GetComponent<Text>() as Text; gsh = GameObject.Find("GameStateHandler").GetComponent<GameStateHandler>(); ammoVariables = GetComponent<AmmunitionVariables>(); gun = GetComponent<Gun>(); shopMenuManager = GameObject.FindGameObjectWithTag("Canvas2").GetComponent<ShopMenuManager>(); //spaceCash = gsh.GetSpaceCash (); }
// public Text ammoText; // AmmunitionVariables ammoVariables; // Gun gun; //PlayerController otherPlayerScript; // Use this for initialization void Start() { // Storing the Y position of the health bar. cachedY = healthTransform.position.y; // Storing the X value of the bar at max health, which is the starting position of the bar. maxXValue = healthTransform.position.x; // The x position of the bar at minimum health is the starting position of the bar minus the width of the rectangle (the health bar). minXValue = healthTransform.position.x - healthTransform.rect.width; currentHealth = maxHealth; ammoVariables = GetComponent<AmmunitionVariables>(); gun = GetComponent<Gun>(); }