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 -- ...
随机推荐
- shell之awk面试小案例
[root@chavinking mnt]# cat textfile chavinking 1 2 3 4 5 6 nope 1 2 3 4 5 6 [root@chavinking mnt]# c ...
- 拳打Adam,脚踢SGD:北大提出全新优化算法AdaBound
https://mp.weixin.qq.com/s/el1E-61YjLkhFd6AgFUc7w
- #include<stdio.h> #include "stdio.h"
https://baike.baidu.com/item/#include <stdio.h> #include <stdio.h> 编辑 #include<stdio. ...
- [administrative][archlinux][clonezilla][disk cloning] 一块 windows 10 硬盘的备份
https://wiki.archlinux.org/index.php/disk_cloning https://wiki.archlinux.org/index.php/full_system_b ...
- MyEclipse中JDK运行环境和编译环境的设置
一.设置myEclipse中新项目使用的JDK 1.运行环境 [Window]->[Preferences]->[Java]->[Installed JREs] 步骤:Add-- ...
- ATL Thunk机制深入分析
如果你有SDK的编程经验,就一定应该知道在创建窗口时需要指定窗口类,窗口类中的一种重要的参数就是窗口过程.任何窗口接收到的消息,都是由该窗口过程来处理. 在面向对象编程中,如果还需要开发人员来使用原始 ...
- html5页面自适应移动端
1. <!-- 这段代码的意思是,让 viewport 的宽度等于物理设备上的真实分辨率,不允许用户缩放,这样 dpi 肯定和设备上的真实分辨率是一样的,不做任何缩放,网页会因此显得更细腻. 1 ...
- NMAP执行脚本smb-check-vulns.nse出错
错误信息:NSE: failed to initialize the script engine: /usr/bin/../share/nmap/nse_main.lua:801: ‘smb-chec ...
- python下载youtube视频
谷歌开源了一个新的数据集,BoundingBox,(网址在这里)这个数据集是经过人工标注的视频数据集,自然想将它尽快地运用在实际之中,那么首先需要将其下载下来:可以看到网址上给出的是csv文件,该文件 ...
- 8.0-uC/OS-III单任务应用
1.单任务应用 app.c文件: (1).APP_CFG.H 是用于配置的头文件.例如, APP_CFG.H 中包含的#define常量确定了任务优先级,堆栈大小,以及其他特性. BSP.H 是 BS ...