mirror of
https://github.com/Ratstail91/Keep-It-Alive.git
synced 2025-11-29 02:24:27 +11:00
Working on it
This commit is contained in:
39
Assets/Scripts/GameObjects/Fire.cs
Normal file
39
Assets/Scripts/GameObjects/Fire.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Fire : MonoBehaviour {
|
||||
Animator animator;
|
||||
LevelController levelController;
|
||||
|
||||
[SerializeField]
|
||||
int size = 1;
|
||||
|
||||
void Awake() {
|
||||
animator = GetComponent<Animator>();
|
||||
levelController = GameObject.Find("Level Controller").GetComponent<LevelController>();
|
||||
}
|
||||
|
||||
void Start() {
|
||||
animator.speed = 1f / 10f;
|
||||
}
|
||||
|
||||
void Update() {
|
||||
//change based on global light level
|
||||
if (levelController.globalLightLevel <= 0.3f) {
|
||||
size = 1;
|
||||
} else if (levelController.globalLightLevel < 0.7f) {
|
||||
size = 2;
|
||||
} else {
|
||||
size = 3;
|
||||
}
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
HandleAnimation();
|
||||
}
|
||||
|
||||
void HandleAnimation() {
|
||||
animator.SetInteger("size", size);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user