Hello, i’ve downloaded a script to dynamic crosshair, but i want to make the if inputs on my own weapon script, i will put a part of the weapon script here:
public void Shoot() {
if(magBullets > 0 && canFire == true && !animationGun.isPlaying) {
magBullets -= 1;
canFire = false;
audio.clip = fireSound;
audio.Play();
animationGun.clip = fireAnim;
animationGun.Play();
OnShoot();
spread += spreadPerSecond * Time.deltaTime;
}
else {
spread -= spreadPerSecond * 2 * Time.deltaTime;
}
If you can see there is a variable called spread and other caled spreadPerSecond.
i want to inherit that variables from the crosshair script that i have.
On weapon variables I have:
public CrossHair spread;
public CrossHair spreadPerSecond;
And on crosshair script i have:
public float spreadPerSecond = 150.0f;
[HideInInspector] public float spread;
And i have the error:
Assets/Scripts/WeaponBase.cs(110,35): error CS0019: Operator *' cannot be applied to operands of type
CrossHair’ and `float’