-
Notifications
You must be signed in to change notification settings - Fork 0
/
GlobalAnimation.cs
56 lines (46 loc) · 1.46 KB
/
GlobalAnimation.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using UnityEngine;
using System.Collections;
public class GlobalAnimation : MonoBehaviour
{
public Animator animatorPlayer;
public Animator[] animatorEnemy = new Animator[12];
float count = 0f;
float num = 0f;
// Use this for initialization
void Start ()
{
animatorPlayer = animatorPlayer.GetComponent<Animator>();
animatorEnemy[Menu.numLevel -1] = GameObject.FindWithTag ("Enemy").GetComponent<Animator>();
}
// Update is called once per frame
void Update ()
{
if (count < num && count != num)
count += 1f;
if (count > num && count != num)
count -= 1f;
if (Player.died == false)
{
animatorPlayer.SetBool ("Walk", Player.walking);
animatorPlayer.SetBool ("Run", Player.running);
animatorPlayer.SetInteger ("Weapon", Inventory.currentWeapon);
animatorPlayer.SetBool ("PickUp", Player.pressToGetItem);
animatorPlayer.SetBool ("Jump", Player.jumped);
animatorPlayer.SetBool ("Attack", Player.attacked);
animatorPlayer.SetBool ("Sight", Player.sighting);
if (Inventory.currentWeapon == -1)
num = 0f;
if (Inventory.currentWeapon == 1)
num = 5f;
if (Inventory.currentWeapon == 8)
num = 1;
animatorPlayer.SetFloat ("Animation", count);
animatorPlayer.SetFloat ("SubAnimation", Player.numSubAnimation);
}
if (Enemy.died == false)
{
animatorEnemy[Menu.numLevel -1].SetBool ("Walk", Enemy.walking);
animatorEnemy[Menu.numLevel -1].SetBool ("Run", Enemy.running);
}
}
}