animator 新动画
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 新动画的更多相关文章
- Unity3D学习笔记(十六):Animator新动画
新动画系统: 给模型选择动画类型 普通动画:Generic 人形动画:Humanoid 建立动画控制器 - 在Project右击 - 选择Create-AnimatorContorller 将对应动画 ...
- 【Android - 基础】之Animator属性动画
1 概述 在3.0系统之前,Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画: 1) 逐帧动画的原理很简单,就是 ...
- Unity 4.0 中的新动画系统——MecAnim
分享一个文档资料,关于动画系统的,版本应该很老了,但是有借鉴意义的: Unity 4.0 已于 2012 年 11 月 15 日正式发布,Unity 每一次版本的提升,都给游戏开发者带来惊喜,这一次也 ...
- (六)Unity5.0新特性------新动画功能
unity 5.0 中的新动画功能 这里是你能够期待的新动画功能高速概述 ! State Machine Behaviours状态机行为 在Unity 5 中,你会能够将StateMachine ...
- 【Android - 进阶】之Animator属性动画
1.概述 在3.0系统之前,Android给我们提供了逐帧动画Frame Animation和补间动画Tween Animation两种动画: 逐帧动画的原理很简单,就是将一个完整的动画拆分成一张张单 ...
- Animator 设置动画效果
1. 调节预设对象大小适中 2. 设置骨骼,修改关节 3. 拖入预设动作效果对象中 4. 将预设对象拉入场景中,并新建AnimatorController 5. 新建动作或BlendTree,设置参数 ...
- CSS3新动画效果
CSS3添加了几个动画效果的属性,通过设置这些属性,可以做出一些简单的动画效果而不需要再去借助JavaScript.CSS3动画的属性主要分为三类:transform.transition以及anim ...
- Android5.0新动画之VectorDrawable
SVG是前端的一套标准,Vector是在Android中使用,他只是实现了SVG语言的Path的标签 Vector的常用语法 M = moveto(M X,Y): 将画笔移动到指定的坐标位置 ...
- Unity动画机制 Animator与Animator Controller教程
Unity动画机制Animator 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- ...
随机推荐
- Python:random模块
近排练习代码时候经常会用到random模块,以防后面忘记还是需要记录一下. 首先导入模块: import random random.random():用于生成一个0到1的随机浮点数: 0 <= ...
- present simple, continuous, and be going to 三者区别
https://www.youtube.com/watch?v=a03VKQL0dZg&list=PLZOJurmtexYozmvQGAJnVg3lgiZw0mj-y HOW TO USE F ...
- iOS之WKWebView加载的网页自适应大小
一,前言 有时候在WKWebView加载页面后会发现页面的字会很小, 这是因为原网页没有做手机屏幕尺寸的适配, 那么在后台不做调整的情况下我们移动端怎样来适配页面呢? 以下代码可以适配大小(原本不可以 ...
- [others]tinycore/microcore
https://zh.wikipedia.org/wiki/Tiny_Core_Linux https://github.com/zeit/micro
- [development][lockless][dpdk] 无锁队列
dpdk: http://dpdk.org/doc/guides/prog_guide/ring_lib.html#ring-library linux: https://lwn.net/Articl ...
- 转:web.xml 配置中classpath: 与classpath*:的区别
原文链接:web.xml 配置中classpath: 与classpath*:的区别 引用自:http://blog.csdn.net/wxwzy738/article/details/1698393 ...
- django上下文处理器
上下文处理器(context processors)上下文处理器是可以返回一些数据,在全局模板中都可以使用.比如登录后的用户信息,在很多页面中都需要使用,那么我们可以放在上下文处理器中,就没有必要在每 ...
- linux常用查看文件或日志命令
常见查看文件内容命令汇总如下: cat filename 查看日志,会打开整个文件,直接跑到最后面 tac filename 查看日志,会打开整 ...
- 转载:caffe中的Reshape层
http://blog.csdn.net/terrenceyuu/article/details/76228317 #作用:在不改变数据的情况下,改变输入的维度 layer { name: " ...
- 前端 HTML 常用标签 head标签相关内容 link标签
link标签 引入CSS样式文件 href="./index.css" CSS文件的路径 <!-- 引入CSS样式文件 --> <link rel="s ...