0
我想让我的角色在按“P”时射击。我创建了一个名为shoot的触发器,并且在动画器状态机中,已经将拍摄动画来回连接到空闲动画。无论我尝试过什么,按下“p”时,“拍摄”动画都会拒绝播放。我的“run”参数包含从idle-> run的动画混合树,在按D或A时完美地工作,然而,每当我按下P时,不想拍摄,只停留在空闲状态。任何想法我做错了什么?'射击'动画不能在Unity中播放
预先感谢您
编辑: 动画图像
http://i60.tinypic.com/i6kq9t.png
using UnityEngine;
using System.Collections;
public class NewSoldier : MonoBehaviour {
Animator animator;
bool Shoot;
float Running = 0.08f;
// Use this for initialization
void Start() {
//float Run;
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update() {
float speed = Input.GetAxis ("Horizontal");
if (Input.GetKey ("d")) {
this.transform.Translate (Input.GetAxis ("Vertical"), 0, Running);
transform.rotation = Quaternion.Euler (0, 90, 0);
animator.SetFloat ("Run", Mathf.Abs (speed));
}
else if (Input.GetKey ("a"))
{
this.transform.Translate (Input.GetAxis ("Vertical"), 0, Running);
transform.rotation = Quaternion.Euler (0, -90, 0);
animator.SetFloat ("Run", Mathf.Abs (-(speed)));
}
else if (Input.GetKeyDown ("p"))
{
animator.SetBool("Shoot", true);
animator.SetTrigger ("Shoot");
}
else
{
bool Shoot = false;
animator.SetFloat ("Run", Mathf.Abs(speed));
}
}
}
喜穗, 我附上了动画的截图: http://i60.tinypic.com/i6kq9t.png (低代表所以不能使用stackoverflows功能)。 我无法发现问题。此刻我希望自己的角色能够在他只是空闲时按'p'的时候进行拍摄。一旦我可以完美的,那么我可以添加运行等转换。 –
任何一个有想法:( –