hello again ive done a rewrite of my previous weapon script so i could think it through and ive run into a snag, i want to decrease the speed of my reload animation if the player doesent press r before running out of bullets in the guns mag but the snag is that im new to coding, been doing it for two slow months learned a lot
so heres the code it mostly works but a s i said i want to slow the reload animation
using UnityEngine;
using System.Collections;
public class Weaponcontrol : MonoBehaviour {
public bool Hasammo = !false;
public int Maxrounds = 17;
public int Currounds = 17;
public GameObject Gun;
public float Playspeed = 1.0f;
public Animation Fire;
public Animation Reload;
void Start () {
Fire = Gun.animation.GetComponent (Fire.animation);
Reload = Gun.animation.GetComponent (Reload.animation);
}
void Update (){
if (Input.GetMouseButtonDown(0));
{
Hasammo = !false;
}
Gun.animation.Play (Fire);
Currounds-=1;
if (Hasammo = false);
{
Gun.animation.Play (Reload);
}
animation[Reload].speed = Playspeed //i want to take a a quater off playspeed and set the remainder to the animation speed as a float
Currounds = Maxrounds;
if (Currounds <= 0){
Hasammo = false;
}
else
{
Hasammo = !false;
if(Input.GetKeyDown(KeyCode.R)){
Gun.animation.Play(Reload);
Currounds = Maxrounds;
}
}
}
}
its changed a lot from my last question whats the bet way to do this
as requested here are the pics [33767-unity+1.png|33767]
and [33768-unity+2.png|33768]
sorry it took a few hours