Pull to refresh
0
@artemymazurenkoread⁠-⁠only

User

Send message
using UnityEngine;
using System.Collections;

public class CharacterControllerScript: MonoBehaviour
{
public float maxSpeed = 10f;
private bool isFacingRight = true;
private Animator anim;
/// ///
private void Start()
{
anim = GetComponent();
}
/// /// FixedUpdate
/// Animate Physics = true
///
private void FixedUpdate()
{
float move = Input.GetAxis(«Horizontal»);
anim.SetFloat(«Speed», Mathf.Abs(move));
rigidbody2D.velocity = new Vector2(move * maxSpeed, rigidbody2D.velocity.y);
if (move > 0 && !isFacingRight)
Flip();
else if (move < 0 && isFacingRight)
Flip();
}
/// ///
private void Flip()
{
isFacingRight = !isFacingRight;
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
}
Всё сделал. Но не работает. Работаю в Unity3D 5 и не знаю что делать.

Information

Rating
Does not participate
Registered
Activity