Cositas (~ ̄▽ ̄)~

This commit is contained in:
Gerard Gascón 2023-03-01 17:14:24 +01:00
parent db7b5af053
commit 55b18c6def
28 changed files with 4095 additions and 123 deletions

View file

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -7,6 +8,9 @@ public class GhostController : MonoBehaviour {
[SerializeField] float speed;
[SerializeField] Transform player;
[SerializeField, Range(0f, 20f)] float accelerationPower = 10;
float _currentSpeed;
Animator _anim;
Rigidbody2D _rb2d;
@ -16,11 +20,15 @@ public class GhostController : MonoBehaviour {
_rb2d = GetComponent<Rigidbody2D>();
}
void Update() {
_currentSpeed = speed * Mathf.Log(GameManager.instance.CurrentTime + accelerationPower, accelerationPower);
}
// Update is called once per frame
void FixedUpdate() {
if (_hasKilled) return;
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * speed);
_rb2d.position = Vector2.MoveTowards(_rb2d.position, player.position, Time.deltaTime * _currentSpeed);
}
bool _hasKilled;

View file

@ -5,6 +5,7 @@ using GometGames.Tools;
using MyBox;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Serialization;
using Random = UnityEngine.Random;
[System.Serializable]
@ -28,12 +29,31 @@ public class GameManager : MonoBehaviour {
OrbTypes _lastType = OrbTypes.None;
public static GameManager instance;
[Header("Clock")]
[SerializeField] int time = 180;
public float CurrentTime { private set; get; }
[SerializeField] int doorTime = 30;
[SerializeField] RectTransform clockPivot;
// Start is called before the first frame update
void Awake() {
instance = this;
}
void Update() {
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");
}
}
}
public OrbTypes SelectRandomEffect() {
OrbTypes selected;
do {

View file

@ -62,6 +62,8 @@ public class PlayerController : MonoBehaviour {
//vCam.m_Follow = _cameraTarget;
_currentSpeed = speed;
PlayerPrefs.SetInt("OrbsFound", 0);
}
void Update() {
@ -133,6 +135,9 @@ public class PlayerController : MonoBehaviour {
_anim.SetTrigger(Die);
_dead = true;
ScreenShake.Shake(20f, .5f);
}else if (col.CompareTag("Orb")) {
PlayerPrefs.SetInt("OrbsFound", PlayerPrefs.GetInt("OrbsFound", 0) + 1);
Destroy(col.gameObject);
}
}

View file

@ -0,0 +1,38 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MyBox;
using SimpleTools.DialogueSystem;
using UnityEngine;
using UnityEngine.UI;
public class WinScreen : MonoBehaviour {
[SerializeField] GameObject[] orbs;
[SerializeField] Dialogue dialogue;
[SerializeField] float fadeDuration;
[SerializeField] Image occluder;
// Start is called before the first frame update
void Awake(){
for (int i = 0; i < orbs.Length; i++) orbs[i].SetActive(i + 1 <= PlayerPrefs.GetInt("OrbsFound"));
}
// Start is called before the first frame update
IEnumerator Start() {
yield return new WaitForSeconds(fadeDuration);
DialogueManager.instance.Dialogue(dialogue);
}
float _start;
void Update() {
float alpha = Mathf.Lerp(1, 0, (Time.time - _start) / fadeDuration);
alpha = Mathf.Round(alpha * 5);
alpha /= 5f;
occluder.SetAlpha(alpha);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0151a2af4d893914493dceeb1219a70e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: