Demasiadas cosas
This commit is contained in:
parent
55b18c6def
commit
3d9aad6211
81 changed files with 7438 additions and 890 deletions
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using GometGames.Tools;
|
||||
using MyBox;
|
||||
using SimpleTools.AudioManager;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
|
@ -36,24 +38,51 @@ public class GameManager : MonoBehaviour {
|
|||
[SerializeField] int doorTime = 30;
|
||||
|
||||
[SerializeField] RectTransform clockPivot;
|
||||
|
||||
bool _doorOpened, _dead;
|
||||
|
||||
[SerializeField] UnityEvent doorOpenEvent;
|
||||
[SerializeField] UnityEvent timeEndEvent;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Awake() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
void Start() {
|
||||
AudioManager.instance.FadeIn("Viento", 1f);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (_stopped) return;
|
||||
|
||||
CurrentTime += Time.deltaTime;
|
||||
float ratio = CurrentTime / time;
|
||||
clockPivot.rotation = Quaternion.Euler(0f, 0f, ratio * 360f - 180f);
|
||||
if (CurrentTime >= time - doorTime) {
|
||||
Debug.Log("DoorOpened");
|
||||
if (CurrentTime >= time) {
|
||||
Debug.Log("TimesUp");
|
||||
if (!_doorOpened) {
|
||||
_doorOpened = true;
|
||||
AudioManager.instance.Play("Puerta");
|
||||
AudioManager.instance.FadeOut("Puerta", 1f);
|
||||
doorOpenEvent.Invoke();
|
||||
}
|
||||
if (CurrentTime >= time && !_dead) {
|
||||
_dead = true;
|
||||
timeEndEvent.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[SerializeField] CanvasGroup group;
|
||||
[SerializeField] CanvasController controller;
|
||||
bool _stopped;
|
||||
public void DisableManager() {
|
||||
group.DOFade(0, 1f);
|
||||
controller.AbortCoroutine();
|
||||
group.interactable = false;
|
||||
_stopped = true;
|
||||
}
|
||||
|
||||
public OrbTypes SelectRandomEffect() {
|
||||
OrbTypes selected;
|
||||
do {
|
||||
|
@ -64,13 +93,6 @@ public class GameManager : MonoBehaviour {
|
|||
return selected;
|
||||
}
|
||||
|
||||
[Space, SerializeField] OrbTypes forceEventChangeType = OrbTypes.None;
|
||||
[ButtonMethod]
|
||||
void ForceEventChange() {
|
||||
if (!Application.isPlaying) return;
|
||||
ChangeEventCall(forceEventChangeType);
|
||||
}
|
||||
|
||||
void ChangeEventCall(OrbTypes type) {
|
||||
if(currentType != OrbTypes.None) orbEndEffects[currentType].Invoke();
|
||||
_lastType = currentType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue