Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 统一动画和任何国家问题_C#_Unity3d_Unity2d_Animator - Fatal编程技术网

C# 统一动画和任何国家问题

C# 统一动画和任何国家问题,c#,unity3d,unity2d,animator,C#,Unity3d,Unity2d,Animator,嘿,伙计们,我对动画师有一个问题,我制作了一个可以转换的播放器(播放器动画=空闲;运行;滑动;跳跃===加===播放器trasform动画=trasform;idlePlayerAfterTransform;runPlayerAfterTransform;SlidePlayerAfterTransform;jumpPlayerAfterTransform),我添加了测试攻击动画和攻击空闲。问题是我遵循了一个教程,我使用ANYSTATE作为所有动画之间关系的基础,当我添加trasform动画时,它

嘿,伙计们,我对动画师有一个问题,我制作了一个可以转换的播放器(播放器动画=空闲;运行;滑动;跳跃===加===播放器trasform动画=trasform;idlePlayerAfterTransform;runPlayerAfterTransform;SlidePlayerAfterTransform;jumpPlayerAfterTransform),我添加了测试攻击动画和攻击空闲。问题是我遵循了一个教程,我使用ANYSTATE作为所有动画之间关系的基础,当我添加trasform动画时,它们不工作,也攻击动画我不知道该怎么做我真的卡住了我是动画管理器的脚本

使用UnityEngine;
使用系统集合;
公共类玩家管理者:单一行为{
私人输入状态输入;
私人步行b;
私人动画师;
私人冲突国家;
私人wallj;
私人跳伞;
公共布尔攻击;
public int lastPressed=0;
无效唤醒()
{
inputSs=GetComponent();
walkB=GetComponent();
anim=GetComponent();
CS=GetComponent();
wallj=GetComponent();
longJ=GetComponent();
}
无效开始(){
}
无效更新(){
//干活儿=====================================================
if(CS.standing&&Input.GetKeyDown(KeyCode.Alpha1)){
攻击=真;
动物状态(2);
如果(CS.站立和攻击){
攻击=错误;
}
}
//==================================================
anim.SetFloat(“Vspeed”,GetComponent().velocity.y);
//闲散=========================
如果(CS站立和攻击){
动物状态(0);
}
//=============================
//运行动画=====================
if(inputSs.absX>0&!攻击){
动物状态(1);
}
//==================================
//滑动============================
如果(!CS.standing&&CS.wall){
动物状态(3);
}
//================================
//坠落与跳跃=========================
如果(!CS.standing&&!CS.wall&&!attack){
动物状态(5);
}
//================================
//运行动画速度=======================
anim.speed=walkB.running?walkB.runM:1;
//=========================================
}
无效动画状态(int值){
anim.SetInteger(“animS”,值);
}
}

当任何动画状态(如空闲、攻击、运行)完成时,我的意思是灰色动画,它们是否返回到任何状态(蓝色动画)?动画(运行、滑动和跳跃(blendtree))返回到任意状态并正常工作问题是,当我添加图片中的其他动画时,即使我激活它们,它们也不工作。抛出脚本,它们不工作,并且总是返回默认状态(空闲),但对于(跳跃和滑动动画),它们工作正常,我不知道为什么??
using UnityEngine;
using System.Collections;

public class PlayerManager : MonoBehaviour {

    private inputStates inputSs;
    private walk walkB;
    private Animator anim;
    private CollisionState CS;
    private wallJump wallj;
    private Jump longJ;

    public bool attack;


    public int lastPressed = 0;


    void Awake()
    {
        inputSs = GetComponent<inputStates> ();
        walkB = GetComponent<walk> ();
        anim = GetComponent<Animator> ();
        CS = GetComponent<CollisionState> ();
        wallj = GetComponent<wallJump> ();
        longJ = GetComponent<Jump> ();
    }
    void Start () {
    }
    void Update () {
        //DOZENT WORK =====================================================
        if (CS.standing && Input.GetKeyDown (KeyCode.Alpha1)) {     
            attack = true;
            AnimState (2);

            if (CS.standing && attack) {
                attack = false;
            }
        }
        //==================================================

        anim.SetFloat ("Vspeed", GetComponent<Rigidbody2D> ().velocity.y);
        //IDLE=========================
        if (CS.standing && !attack) {
            AnimState(0);
        }
        //=============================

        //run animation=====================
        if (inputSs.absX > 0 && !attack) {
            AnimState(1);

        }
        //==================================


        //slid============================
        if (!CS.standing && CS.wall) {

            AnimState(3);
        }
        //================================

        //falling & jump =========================
        if (!CS.standing && !CS.wall && !attack) {
            AnimState(5);
        }
        //================================

        //run animation speed=======================
        anim.speed = walkB.running ? walkB.runM : 1;
        //=========================================
    }

    void AnimState(int value){

        anim.SetInteger ("animS", value);
    }
}