This commit is contained in:
Gerard Gascón 2025-04-24 14:20:42 +02:00
commit 9afd57306d
323 changed files with 204673 additions and 0 deletions

View file

@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Game14Player : MonoBehaviour{
public GameObject death;
public float moveSpeed = 600f;
float movement;
// Update is called once per frame
void Update(){
if (Input.GetKeyDown(KeyCode.Space)){
movement = 1;
}
if (Input.GetKeyUp(KeyCode.Space)){
movement = 0;
}
}
void FixedUpdate(){
transform.RotateAround(Vector3.zero, Vector3.forward, movement * Time.fixedDeltaTime * -moveSpeed);
}
void OnTriggerEnter2D(Collider2D col){
AudioManager.instance.Play("Hit");
StartCoroutine(Death());
Time.timeScale = 0;
death.transform.rotation = Camera.main.transform.rotation;
death.SetActive(true);
}
IEnumerator Death(){
yield return new WaitForSecondsRealtime(5f);
FindObjectOfType<GameController>().LoseGame();
}
}