using System.Collections;
using System.Collections.Generic;
using UnityEngine; public class AnimatorCon : MonoBehaviour {
Animator ani;
// Use this for initialization
void Start () {
ani = GetComponent<Animator>();
} // Update is called once per frame
void Update () {
float h = Input.GetAxis("Horizontal");//控制移动
float v = Input.GetAxis("Vertical");
transform.Translate(h*Time.deltaTime,,v*Time.deltaTime);
if (h<)
{
transform.localScale = new Vector3(-,,);//反向移动
}
else
{
transform.localScale = Vector3.one;
}
if (h!=||v!=)
{
ani.SetBool("IsRun",true);
}
else
{
ani.SetBool("IsRun", false);
}
if (Input.GetKeyDown(KeyCode.Q))
{ ani.SetBool("IsAttack",true);
}
else
{
ani.SetBool("IsAttack", false);
} }
}

2.int类型

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//animator动画状态机int类型的控制
public class DragonControlor : MonoBehaviour {
Animator ani;
// Use this for initialization
void Start () {
ani = GetComponent<Animator>();
}
public void GetButtonQ()
{
ani.SetInteger("com", );//对paiameters进行设置
}
public void GetButtonW()
{
ani.SetInteger("com", -);//对paiameters进行设置
ani.SetInteger("con", );
}
public void GetButtonE()
{
ani.SetInteger("con", -);//对paiameters进行设置
}
// Update is called once per frame
void Update () {
AnimatorStateInfo start = ani.GetCurrentAnimatorStateInfo();//判断当前动画状态
if (start.IsName("dragon_land_on_ground"))
{
ani.SetInteger("com", );//让它返回
}
if (start.IsName("dragon_die"))
{
ani.SetInteger("com", );
}
if (start.IsName("dragon_loop_da_loop"))
{
ani.SetInteger("con", );
}
}
}
AnimatorStateInfo aniSta=  ani.GetCurrentAnimatorStateInfo();//获得当前层的动画片段状态信息
if (h != || v != )
{
ani.SetBool("IsWalk", true);
if (Input.GetKey(KeyCode.LeftShift))
{
ani.SetBool("IsRun", true);
}
else
{
ani.SetBool("IsRun", false);
}
}
else
{
if (aniSta.IsName("run"))//判断是否正在播放此动画
{
ani.SetBool("IsRun", false);
}
ani.SetBool("IsWalk", false);
}

animator 新动画的更多相关文章

  1. Unity3D学习笔记(十六):Animator新动画

    新动画系统: 给模型选择动画类型 普通动画:Generic 人形动画:Humanoid 建立动画控制器 - 在Project右击 - 选择Create-AnimatorContorller 将对应动画 ...

  2. 【Android - 基础】之Animator属性动画

    1      概述 在3.0系统之前,Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画: 1)        逐帧动画的原理很简单,就是 ...

  3. Unity 4.0 中的新动画系统——MecAnim

    分享一个文档资料,关于动画系统的,版本应该很老了,但是有借鉴意义的: Unity 4.0 已于 2012 年 11 月 15 日正式发布,Unity 每一次版本的提升,都给游戏开发者带来惊喜,这一次也 ...

  4. (六)Unity5.0新特性------新动画功能

     unity 5.0 中的新动画功能 这里是你能够期待的新动画功能高速概述 ! State Machine Behaviours状态机行为 在Unity 5 中,你会能够将StateMachine ...

  5. 【Android - 进阶】之Animator属性动画

    1.概述 在3.0系统之前,Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画: 逐帧动画的原理很简单,就是将一个完整的动画拆分成一张张单 ...

  6. Animator 设置动画效果

    1. 调节预设对象大小适中 2. 设置骨骼,修改关节 3. 拖入预设动作效果对象中 4. 将预设对象拉入场景中,并新建AnimatorController 5. 新建动作或BlendTree,设置参数 ...

  7. CSS3新动画效果

    CSS3添加了几个动画效果的属性,通过设置这些属性,可以做出一些简单的动画效果而不需要再去借助JavaScript.CSS3动画的属性主要分为三类:transform.transition以及anim ...

  8. Android5.0新动画之VectorDrawable

    SVG是前端的一套标准,Vector是在Android中使用,他只是实现了SVG语言的Path的标签 Vector的常用语法   M = moveto(M X,Y): 将画笔移动到指定的坐标位置   ...

  9. Unity动画机制 Animator与Animator Controller教程

    Unity动画机制Animator 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- ...

随机推荐

  1. MySQL的一些概念

    数据库与服务器.客户端的层次关系 关于数据库 程序中需要存储数据的方式: 1 变量(列表.元组.集合.字典.嵌套) 2 外存(文件)(*.ini) 3 表格.Excel(*.xls.*.xlsx.*. ...

  2. SQL Server 2008 事件探查器(SQL SERVER Profiler)

    要想很好地优化ERP系统,可以从客户端.服务器.网络等入手,对于我们M1系统的优化来说,SQL 语句的优化就起到很重要的作用了.为此,我们展开,学习了SQL SERVER 2008的事件探查器(SQL ...

  3. nodejs prefix(全局)和cache(缓存)windows下设置

    引:在安装完nodejs后,通过npm下载全局模块默认安装到{%USERDATA%}C:\Users\username\AppData\下的Roaming\npm下,这当然是不太对的默认. 1,安装L ...

  4. Java之旅_面向对象_包(Package)

    http://www.runoob.com/java/java-package.html 包的作用: 1.把功能相似或相关的类或接口组织在同一个包中,方便类的查找和使用. 2.如同文件夹一样,包也采用 ...

  5. (1.12)SQL优化——mysql表名、库名大小写敏感

    mysql表名.库名大小写敏感 关键词:mysql大小写敏感

  6. Visual Studio 10.0设置引用HalconDotNet.dll

    版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u010435562/article/details/8858638 開始做Halcon的上位机.选用 ...

  7. docker+jenkins+maven简单部署

    构建jar包 1.拉取jenkins容器景象 docker pull docker.io/jenkins/jenkins 2.配置映射目录,创建一个容器 mkdir /data/jenkins doc ...

  8. 20181017 PL/SQL 记录

    1. 配置DB 链接文件,帮助中找到tnsnames.ora文件路径,进行注册数据库信息,登陆即可. 这只是个客户端,具体服务器段数据库情况不清楚. 2.写法区别PL/SQL 和SQL 变量定义 赋值 ...

  9. what's the python之函数及装饰器

    what's the 函数? 函数的定义:(return是返回值,可以没有,不过没有的话就返回了None) def wrapper(参数1,参数2,*args,默认参数,**kwargs): '''注 ...

  10. Mysql常用的存储引擎

    存储引擎 存储引擎是表级别的概念,不同的存储引擎保存数据和索引的方式是不相同的. MyISAM存储引擎 MyISAM最典型的性能问题就是表锁的问题.  MyISAM只将数据写到内存中,然后等待操作系统 ...