49 lines
1012 B
C#
49 lines
1012 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class DaBi : MonoBehaviour {
|
|
|
|
public int Kind;
|
|
public Animator Ani;
|
|
float bValue = 0;
|
|
public AudioSource Aud_Run;
|
|
void Start () {
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update ()
|
|
{
|
|
if (Kind == 1)//升
|
|
{
|
|
bValue +=0.00045f;
|
|
if (bValue > 1)
|
|
{
|
|
bValue = 1;
|
|
Kind = 0;
|
|
}
|
|
Ani.SetFloat("Blend", bValue);
|
|
if (!Aud_Run.isPlaying)
|
|
Aud_Run.Play();
|
|
}
|
|
else if (Kind == -1)
|
|
{
|
|
bValue -= 0.00045f;
|
|
if (bValue < 0)
|
|
{
|
|
bValue = 0;
|
|
Kind = 0;
|
|
}
|
|
Ani.SetFloat("Blend", bValue);
|
|
if (!Aud_Run.isPlaying)
|
|
Aud_Run.Play();
|
|
}
|
|
else
|
|
{
|
|
if (Aud_Run.isPlaying)
|
|
Aud_Run.Stop();
|
|
}
|
|
}
|
|
}
|