init
This commit is contained in:
commit
9afd57306d
323 changed files with 204673 additions and 0 deletions
39
Assets/Scripts/Game14/Game14Player.cs
Normal file
39
Assets/Scripts/Game14/Game14Player.cs
Normal 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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue