【发布时间】:2015-01-19 03:19:26
【问题描述】:
现在我正在浏览动画,我已经成功地制作了一个自上而下的小型射击游戏。我遵循了pixelnest.io的几个教程,但奇怪的是我收到一条错误消息,说“参数'moveRight'不存在。统一的动画对我来说是全新的,并且一直在尝试尽可能多地阅读。任何修复动画以便在我向右移动时播放的建议?下面是一些图片和我的代码。
using UnityEngine;
使用 System.Collections;
公共类 playerMove : MonoBehaviour {
public float maxSpeed = 5f;
Animator animator;
bool isRight;
void Awake(){
animator = GetComponent<Animator>();
}
void Update(){
Vector3 posMove = transform.position;
Vector3 velocityH = new Vector3 (Input.GetAxis ("Horizontal") * maxSpeed * Time.deltaTime, 0, 0);
//this is just test a before i add it to the right movement
animator.SetBool ("moveRight", isRight);
Vector3 velocityV = new Vector3 (0, Input.GetAxis ("Vertical") * maxSpeed * Time.deltaTime, 0);
posMove += velocityH + velocityV;
transform.position = posMove;
}
}
【问题讨论】: