Updated visuals and polish

This commit is contained in:
2020-01-27 16:31:38 +01:00
parent 0d80cee4aa
commit 12dbfae935
39 changed files with 1486 additions and 28 deletions

View File

@@ -9,17 +9,24 @@ public class GameManager : MonoBehaviour
{
public AudioClip goalSound;
[Header("Tankstellen")]
public int scorePlayer1 = 0;
public int scorePlayer2 = 0;
public int maxGoals = 1;
[Header("Player")]
public float inputTimeout = 0.3f;
public Transform player1;
public Transform player2;
public GameObject[] players;
[Header("Boll")]
public Transform ball;
public Transform player1Initial, player2Initial, ballInitial;
public GameObject[] players;
private Transform player1Initial, player2Initial, ballInitial;
[Header("Misc")]
public Vector3[] initialPositions;
public Quaternion[] initialRotations;
@@ -60,7 +67,7 @@ public class GameManager : MonoBehaviour
{
//Debug.Log("Calculating matrix: Vector(" + Time.deltaTime * Random.Range(12, 123) + ")");
//Debug.Log("Hacking pentagon: in pr0gress...");
this.scoreLabel.text = "Score: " + this.scorePlayer1 + " : " + this.scorePlayer2;
this.scoreLabel.text = this.scorePlayer1 + " : " + this.scorePlayer2;
if (this.scorePlayer1 >= maxGoals)
{
@@ -96,11 +103,11 @@ public class GameManager : MonoBehaviour
this.players[i].transform.position = this.initialPositions[i];
this.players[i].transform.rotation = this.initialRotations[i];
this.players[i].GetComponent<Rigidbody>().velocity = Vector3.zero;
this.players[i].GetComponent<PlayerController>().InputTimeout(this.inputTimeout);
}
this.ball.position = this.ballInitial.position;
this.ball.GetComponent<Rigidbody>().velocity = Vector3.zero;
}
}

View File

@@ -7,6 +7,7 @@ public class Goal : MonoBehaviour
public GameManager gm;
public int playerNumber = 0;
public GoalLight goalLight;
// Start is called before the first frame update
void Start()
{
@@ -32,6 +33,8 @@ public class Goal : MonoBehaviour
this.gm.scorePlayer1 += 1;
}
this.goalLight.LightUp();
this.gm.ResetPositions();
}
}

View File

@@ -0,0 +1,46 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GoalLight : MonoBehaviour
{
public float lerpSpeed = 2.0f;
public float intensity;
private Light light;
private bool resetLight = true;
private float lerpT = 0;
// Start is called before the first frame update
void Start()
{
this.light = GetComponent<Light>();
}
// Update is called once per frame
void Update()
{
if (this.resetLight)
{
this.lerpT -= Time.deltaTime * lerpSpeed;
light.intensity = Mathf.Lerp(0.0f, this.intensity, this.lerpT);
} else
{
this.lerpT += Time.deltaTime * lerpSpeed * 2f;
light.intensity = Mathf.Lerp(0.0f, this.intensity, this.lerpT);
}
if (this.lerpT > 1)
{
this.resetLight = true;
}
}
public void LightUp()
{
this.lerpT = 0;
this.resetLight = false;
this.light.enabled = true;
}
}

View File

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

View File

@@ -22,6 +22,9 @@ public class PlayerController : MonoBehaviour
private AudioSource audioSource;
private AIController aiController;
public float inputTimeout = 0;
// Start is called before the first frame update
void Start()
{
@@ -43,6 +46,11 @@ public class PlayerController : MonoBehaviour
this.rb.drag = this.idleDrag;
if(this.inputTimeout > 0) {
this.inputTimeout -= Time.deltaTime;
return;
}
//Override any inputs if this instance is to be controlled by AI
if (this.aiControlled)
{
@@ -103,14 +111,16 @@ public class PlayerController : MonoBehaviour
this.lockBoost = true;
}
//Irgendwas
//Yeet
if (Time.time > (this.lastBoostTime + this.boostDuration))
{
this.lockBoost = false;
this.forceZone.SetActive(false);
}
}
public void InputTimeout(float t)
{
this.inputTimeout = t;
}
}

8
Assets/Scripts/UI.meta Normal file
View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d0f83d3d941bab64783e502c800e3fec
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class StartButton : MonoBehaviour
{
void OnMouseDown()
{
Debug.Log("Load scene");
SceneManager.LoadScene("main", LoadSceneMode.Single);
}
}

View File

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