void UpdateCurrentShotLevel() { shotCount++; bulletsForThisLevel--; if (bulletsForThisLevel == 0 && currentShotLevelInt < shotLevels.Count - 1) { currentShotLevelInt++; currentShotLevel = shotLevels[currentShotLevelInt]; bulletsForThisLevel = currentShotLevel.availableBullets; weaponRenderer.material.color = shotLevels[currentShotLevelInt].colorRay; } if (currentShotLevelInt == shotLevels.Count - 1) { availableBulletsText.text = "∞"; } else { availableBulletsText.text = bulletsForThisLevel.ToString(); } }
// Use this for initialization void Start() { nView = GetComponent <NetworkView>(); cam = GetComponentInChildren <Camera>(); originAudio = shotOrigin.GetComponent <AudioSource>(); playerAudio = GetComponent <AudioSource>(); hitSound = GameSoundManager.instance.hit; shotSound = GameSoundManager.instance.shot; gameGUIManager = GameGUIManager.instance; fps = GetComponent <FirstPersonController>(); shootAnim = GetComponentInChildren <Animator>(); shotLight = GetComponent <Light>(); shotSystem = shotOrigin.GetComponent <ParticleSystem>(); weaponRenderer = weapon.GetComponent <Renderer>(); weaponRenderer.material = new Material(Shader.Find("Diffuse")); shotDispersion = 0; currentShotLevelInt = 0; currentShotLevel = shotLevels[0]; bulletsForThisLevel = shotLevels[0].availableBullets; weaponRenderer.material.color = shotLevels[0].colorRay; availableBulletsText.text = bulletsForThisLevel.ToString(); }