Контролер анімації
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Go : MonoBehaviour
{
static Animator anim;
public float speed = 10.0F;
bool lookRight = true;
void Start()
{
anim = GetComponent<Animator>();
}
void Flip()
{
lookRight = !lookRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
void Update()
{
float move = Input.GetAxis("Horizontal") * speed;
move *= Time.deltaTime;
transform.Translate(move, 0, 0);
if (lookRight == true && move < 0)
{
Flip();
}
else if (move > 0 && lookRight == false)
{
Flip();
}
if (Input.GetKeyDown(KeyCode.Space))
{
anim.SetTrigger("isJump");
gameObject.GetComponent<Rigidbody2D>().AddForce(new Vector2(0, 2) * 125);
}
//if (translation != 0)
//{
// anim.SetBool("isWalk", true);
//}
//else
//{
// anim.SetBool("isWalk", false);
//}
}
}