private void ChangeColorState() { float mouseWheel = Input.GetAxis("Mouse ScrollWheel"); // scroll up if (mouseWheel > 0f) { colorSelected++; } // scroll down if (mouseWheel < 0f) { colorSelected--; } if (colorSelected % colorStateSize == 0) { colorSelected = 0; } if (colorSelected < 0) { colorSelected = colorStateSize + colorSelected; } currentColorState = (ColorState)colorSelected; gunProperties.SetBulletPrefab(bulletPrefabs[colorSelected]); }
// Use this for initialization void Start() { gunProperties = GetComponent <GunProperties>(); gunFire = gunProperties.GetGunFire(); colorStateSize = System.Enum.GetNames(typeof(ColorState)).Length; gunProperties.SetBulletPrefab(bulletPrefabs[colorSelected]); uiColorImage = GameObject.FindWithTag("BulletColourUI").GetComponent <Image>(); }