Add various sound effects

This commit is contained in:
2019-10-03 00:38:52 +02:00
parent 4bb1730091
commit db9116cfdc
22 changed files with 983 additions and 1 deletions

View File

@@ -3,8 +3,12 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
[RequireComponent(typeof(AudioSource))]
public class GameManager : MonoBehaviour
{
public AudioClip goalSound;
public int scorePlayer1 = 0;
public int scorePlayer2 = 0;
public int maxGoals = 1;
@@ -19,9 +23,11 @@ public class GameManager : MonoBehaviour
public Text scoreLabel;
public Text winLabel;
private AudioSource audioSource;
// Start is called before the first frame update
void Start()
{
this.audioSource = GetComponent<AudioSource>();
this.player1Initial = new GameObject().transform;
this.player1Initial.position = this.player1.position;
this.player1Initial.rotation = this.player1.rotation;
@@ -39,6 +45,8 @@ public class GameManager : MonoBehaviour
// Update is called once per frame
void Update()
{
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;
if (this.scorePlayer1 >= maxGoals)
@@ -67,6 +75,9 @@ public class GameManager : MonoBehaviour
public void ResetPositions()
{
this.audioSource.clip = this.goalSound;
this.audioSource.Play();
this.player1.position = this.player1Initial.position;
this.player1.rotation = this.player1Initial.rotation;
this.player1.GetComponent<Rigidbody>().velocity = Vector3.zero;