我创建了一个名为“m4a4animator”的动画师。在其中,主要功能称为“空闲”(无),其他 2 种状态:“射击”(mouse0)和“重新加载”(R)。这 2 个动画状态转换为“空闲”。现在,一切正常......但我唯一的问题是:如果我正在重新加载并按下鼠标0(射击),动画运行状态立即更改为射击......但我想阻止它.
现在,问题是:如何在动画运行时停止某些动画更改?
这是我的脚本:
using UnityEngine;
using System.Collections;
public class m4a4 : MonoBehaviour {
public Animator m4a4animator;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.R)) {
m4a4animator.Play("reload");
}
if (Input.GetMouseButton(0)) {
m4a4animator.Play("shoot");
}
}
}
Run Code Online (Sandbox Code Playgroud) 我在第56行收到错误...有人可以告诉我为什么吗?我没有在if语句的末尾添加任何分号,我也使用右括号放置......这里有什么问题?我将不胜感激,谢谢!
这是我的代码:
using UnityEngine;
using System.Collections;
public class PlayerPrefsManager : MonoBehaviour {
const string MASTER_VOLUME_KEY = "master_volume";
const string DIFFICULTY_KEY = "difficulty";
const string LEVEL_KEY = "level_unlocked_";
public static void SetMasterVolume(float volume)
{
if (volume > 0f && volume < 1f) {
PlayerPrefs.SetFloat (MASTER_VOLUME_KEY, volume);
} else {
Debug.LogError ("Master volume out of range");
}
}
public static float GetMasterVolume()
{
return PlayerPrefs.GetFloat (MASTER_VOLUME_KEY);
}
public static void UnlockLevel (int level)
{
if (level <= Application.levelCount - 1) {
PlayerPrefs.SetInt(LEVEL_KEY …Run Code Online (Sandbox Code Playgroud)