1
0
Fork 0
Bildschirmflausch-LD41/Assets/Scripts/BrakeBarController.cs

47 lines
865 B
C#
Raw Normal View History

2018-04-22 20:18:18 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BrakeBarController : MonoBehaviour {
2018-04-23 14:57:58 +02:00
2018-04-22 20:18:18 +02:00
int BrakeAmount = 100;
private Player player;
2018-04-22 22:07:57 +02:00
float firstTime;
float secondTime;
2018-04-22 20:18:18 +02:00
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// if player alive and spawned
if (player != null)
{
2018-04-22 22:07:57 +02:00
UpdatePointer();
2018-04-22 20:18:18 +02:00
}
2018-04-23 14:57:58 +02:00
2018-04-22 20:18:18 +02:00
}
2018-04-23 14:57:58 +02:00
2018-04-22 22:07:57 +02:00
private void UpdatePointer()
2018-04-22 20:18:18 +02:00
{
2018-04-23 16:08:16 +02:00
while (Input.GetKey(KeyCode.S))
2018-04-22 22:07:57 +02:00
{
2018-04-23 16:08:16 +02:00
firstTime += 1;
2018-04-22 22:07:57 +02:00
}
if (Input.GetKeyUp(KeyCode.S))
{
2018-04-23 16:08:16 +02:00
gameObject.transform.Rotate(Vector3.forward, firstTime);
2018-04-22 22:07:57 +02:00
}
2018-04-22 20:18:18 +02:00
}
}
2018-04-22 22:07:57 +02:00