protected override void _OnGUI() { base._OnGUI(); ScatterShotWeapon g = owner as ScatterShotWeapon; if (g != null) { if (Fight.f != null && Fight.f.fight_active) { int tex_id = Mathf.Clamp(Mathf.FloorToInt((1f - g.ammo_cooldown / g.sec_to_regain_one_ammo) * reload_textures), 0, reload_textures - 1); GUI.DrawTextureWithTexCoords(new Rect(Screen.width * 0.5f - reloadtexw * 0.5f, reloadtexh, reloadtexw, reloadtexh), reload_atlas, new Rect(reloadw * (tex_id % reload_width), reloadh * (tex_id / reload_width), reloadw, reloadh)); if (g.ammo > 0) { tex_id = Mathf.Clamp(Mathf.FloorToInt((1f - g.charge / g.max_charge) * narrow_textures), 0, narrow_textures - 1); GUI.DrawTextureWithTexCoords(new Rect(Screen.width * 0.5f - narrowtexw * 0.5f, narrowtexh, narrowtexw, narrowtexh), narrow_atlas, new Rect(narroww * (tex_id % narrow_width), narrowh * (tex_id / narrow_width), narroww, narrowh)); } } } }
protected override void _Update() { base._Update(); ScatterShotWeapon s = owner as ScatterShotWeapon; if (s != null) { anim.SetBool("charging", s.charge > 0f); if (s.charge > 0f) { anim.speed = 0.55f * s.charge_per_second / s.max_charge; } else { anim.speed = 1.05f * s.sec_to_regain_one_ammo; } } }