mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-30 13:07:10 +01:00
added fire animation and fire rate
This commit is contained in:
@@ -6,19 +6,17 @@ public class ShootAnimation : MonoBehaviour
|
||||
{
|
||||
private Animator anim;
|
||||
[SerializeField]private GameObject gun;
|
||||
void Start()
|
||||
{
|
||||
anim = gun.GetComponent<Animator>();
|
||||
}
|
||||
|
||||
void OnSwitchWeapon(GameObject newGun)
|
||||
public void OnSwitchWeapon(float fireRate)
|
||||
{
|
||||
gun = newGun;
|
||||
//gun = newGun;
|
||||
anim = gun.GetComponent<Animator>();
|
||||
anim.SetFloat("ShootSpeed",1f/(60f/fireRate));
|
||||
}
|
||||
public void StartShootAnimation(float timeInSeconds)
|
||||
{
|
||||
anim.PlayInFixedTime("Shoot", 0, timeInSeconds);
|
||||
Debug.Log(anim.GetFloat("ShootSpeed"));
|
||||
anim.Play("Shoot");
|
||||
}
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
|
||||
Reference in New Issue
Block a user