mirror of
https://github.com/ConjureETS/Labo_2_Equ_1_a15.git
synced 2026-03-24 01:50:58 +00:00
41 lines
725 B
C#
41 lines
725 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class Animations : MonoBehaviour {
|
|
|
|
private Animator anim;
|
|
private bool isShooting;
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
|
|
anim = GetComponent<Animator>();
|
|
isShooting = false;
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
float mouvementX = Input.GetAxis("Horizontal");
|
|
|
|
|
|
if (Input.GetKeyDown(KeyCode.X))
|
|
{
|
|
isShooting = true;
|
|
} // if
|
|
|
|
|
|
if (Input.GetKeyUp(KeyCode.X))
|
|
{
|
|
isShooting = false;
|
|
} // if
|
|
|
|
|
|
anim.SetFloat("SpeedX", Mathf.Abs(mouvementX));
|
|
anim.SetBool("isShooting", isShooting);
|
|
|
|
}
|
|
|
|
}
|