zoukankan      html  css  js  c++  java
  • 【酷熊科技】工作积累 ----------- 动画播放 直接写代码控制的

    动画 播放

     1 using UnityEngine;
     2 using System.Collections;
     3 
     4 public class GameLoading : MonoBehaviour {
     5 
     6     public bool isAnimate = true;                  // hero 是否播放动画  用于暂停游戏等
     7     public float animateFrameCountPerSecond = 0.1f;    // hero 每秒播放 图片 多少张
     8     public float timeAnimatePlay = 0.0f;           // hero 动画已经播放的时长
     9     public Sprite[] animatorFrames;                // hero 动画 播放的 图片 数组
    10 
    11 
    12     // Use this for initialization
    13     void Start () {
    14     
    15     }
    16     
    17     // Update is called once per frame
    18     void Update ()
    19     {
    20         LoadingAnimate();
    21     }
    22 
    23     private void LoadingAnimate()
    24     {
    25         if (!isAnimate)
    26             return;
    27 
    28         timeAnimatePlay += Time.deltaTime;
    29         int indexAnimate = (int) (timeAnimatePlay / (1.0f/(animateFrameCountPerSecond*animatorFrames.Length)));
    30         
    31         indexAnimate %= animatorFrames.Length;
    32         gameObject.GetComponent<SpriteRenderer>().sprite = animatorFrames[indexAnimate];
    33 
    34     }
    35 
    36 }
  • 相关阅读:
    SharePoint 2013 配置我的网站 图文引导
    关于SharePoint REST中的授权的研究
    SharePoint重置密码功能Demo
    SharePoint 沙盒解决方案 VS 场解决方案
    移动设备和SharePoint 2013
    win32
    win32
    链表复习-1
    win32
    洛谷基础算法
  • 原文地址:https://www.cnblogs.com/dudu580231/p/6651451.html
Copyright © 2011-2022 走看看