WackAMole: Moles only give one point per, a timer has been added, comments

Timer: Created a universal timer

Colours: Improved Comments, cubes now randomly appear on start. When a cube is in a container it gets randomly teleported back
This commit is contained in:
Santi 2024-06-07 14:37:52 +01:00
parent 8e1bfa2b76
commit 3111305a83
12 changed files with 633 additions and 216 deletions

View File

@ -137,6 +137,7 @@ GameObject:
- component: {fileID: 11243060} - component: {fileID: 11243060}
- component: {fileID: 11243064} - component: {fileID: 11243064}
- component: {fileID: 11243065} - component: {fileID: 11243065}
- component: {fileID: 11243066}
m_Layer: 0 m_Layer: 0
m_Name: Cube (1) m_Name: Cube (1)
m_TagString: PickupObject m_TagString: PickupObject
@ -251,6 +252,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &11243066
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 11243058}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &63540143 --- !u!1 &63540143
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -265,6 +278,7 @@ GameObject:
- component: {fileID: 63540147} - component: {fileID: 63540147}
- component: {fileID: 63540146} - component: {fileID: 63540146}
- component: {fileID: 63540145} - component: {fileID: 63540145}
- component: {fileID: 63540150}
m_Layer: 0 m_Layer: 0
m_Name: Cube (7) m_Name: Cube (7)
m_TagString: PickupObject m_TagString: PickupObject
@ -379,6 +393,18 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 63540143} m_GameObject: {fileID: 63540143}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &63540150
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 63540143}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &68930911 --- !u!1 &68930911
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -12072,6 +12098,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!1 &160828132 --- !u!1 &160828132
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -23765,6 +23793,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!43 &227805119 --- !u!43 &227805119
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -35912,6 +35942,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &739774406 --- !u!65 &739774406
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -47801,6 +47833,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!43 &850156295 --- !u!43 &850156295
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -47979,6 +48013,7 @@ GameObject:
- component: {fileID: 876529137} - component: {fileID: 876529137}
- component: {fileID: 876529141} - component: {fileID: 876529141}
- component: {fileID: 876529142} - component: {fileID: 876529142}
- component: {fileID: 876529143}
m_Layer: 0 m_Layer: 0
m_Name: Cube (4) m_Name: Cube (4)
m_TagString: PickupObject m_TagString: PickupObject
@ -48093,6 +48128,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &876529143
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 876529135}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!43 &939033180 --- !u!43 &939033180
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60113,6 +60160,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!1 &1091937918 --- !u!1 &1091937918
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60190,6 +60239,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &1099757773 --- !u!65 &1099757773
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60217,6 +60268,7 @@ GameObject:
- component: {fileID: 1120068328} - component: {fileID: 1120068328}
- component: {fileID: 1120068332} - component: {fileID: 1120068332}
- component: {fileID: 1120068333} - component: {fileID: 1120068333}
- component: {fileID: 1120068334}
m_Layer: 0 m_Layer: 0
m_Name: Cube (3) m_Name: Cube (3)
m_TagString: PickupObject m_TagString: PickupObject
@ -60331,6 +60383,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1120068334
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1120068326}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1123558005 --- !u!1 &1123558005
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60345,6 +60409,7 @@ GameObject:
- component: {fileID: 1123558007} - component: {fileID: 1123558007}
- component: {fileID: 1123558011} - component: {fileID: 1123558011}
- component: {fileID: 1123558012} - component: {fileID: 1123558012}
- component: {fileID: 1123558013}
m_Layer: 0 m_Layer: 0
m_Name: Cube m_Name: Cube
m_TagString: PickupObject m_TagString: PickupObject
@ -60459,6 +60524,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1123558013
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1123558005}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1272725192 --- !u!1 &1272725192
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60473,6 +60550,7 @@ GameObject:
- component: {fileID: 1272725194} - component: {fileID: 1272725194}
- component: {fileID: 1272725198} - component: {fileID: 1272725198}
- component: {fileID: 1272725199} - component: {fileID: 1272725199}
- component: {fileID: 1272725200}
m_Layer: 0 m_Layer: 0
m_Name: Cube (2) m_Name: Cube (2)
m_TagString: PickupObject m_TagString: PickupObject
@ -60587,6 +60665,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1272725200
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1272725192}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1308571409 --- !u!1 &1308571409
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60597,7 +60687,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1308571410} - component: {fileID: 1308571410}
m_Layer: 0 m_Layer: 0
m_Name: Racism m_Name: Containers
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -60672,6 +60762,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &1376790802 --- !u!65 &1376790802
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60908,6 +61000,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!1 &1474533909 --- !u!1 &1474533909
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60954,6 +61048,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &1474533912 --- !u!65 &1474533912
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -60965,8 +61061,8 @@ BoxCollider:
m_IsTrigger: 1 m_IsTrigger: 1
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1.5, y: 3.7, z: 1.5} m_Size: {x: 1.5, y: 5.869747, z: 1.5}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 1.0848737, z: 0}
--- !u!850595691 &1506078724 --- !u!850595691 &1506078724
LightingSettings: LightingSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -61075,6 +61171,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &1551258729 --- !u!65 &1551258729
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -61134,6 +61232,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &1637775324 --- !u!65 &1637775324
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -72840,6 +72940,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!43 &1820899003 --- !u!43 &1820899003
Mesh: Mesh:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -73018,6 +73120,7 @@ GameObject:
- component: {fileID: 1846846726} - component: {fileID: 1846846726}
- component: {fileID: 1846846730} - component: {fileID: 1846846730}
- component: {fileID: 1846846731} - component: {fileID: 1846846731}
- component: {fileID: 1846846732}
m_Layer: 0 m_Layer: 0
m_Name: Cube (5) m_Name: Cube (5)
m_TagString: PickupObject m_TagString: PickupObject
@ -73132,6 +73235,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1846846732
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1846846724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1871629056 --- !u!1 &1871629056
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -84825,6 +84940,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!1 &1872519961 --- !u!1 &1872519961
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -96721,6 +96838,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!1 &1947815994 --- !u!1 &1947815994
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -96997,6 +97116,7 @@ GameObject:
- component: {fileID: 2051963687} - component: {fileID: 2051963687}
- component: {fileID: 2051963691} - component: {fileID: 2051963691}
- component: {fileID: 2051963692} - component: {fileID: 2051963692}
- component: {fileID: 2051963693}
m_Layer: 0 m_Layer: 0
m_Name: Cube (6) m_Name: Cube (6)
m_TagString: PickupObject m_TagString: PickupObject
@ -97111,6 +97231,18 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1} m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &2051963693
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2051963685}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c4117eaed8044c04fa8e28e453955ca6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2117739596 --- !u!1 &2117739596
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -97157,6 +97289,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
done: 0 done: 0
boxes: []
waitTime: 3
--- !u!65 &2117739599 --- !u!65 &2117739599
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoxSpawns : MonoBehaviour
{
//*Start is called before the first frame update
void Start()
{
//*Randomly spawn boxes when the game starts
gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10));
}
//*Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -1,18 +1,27 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
//* Cubes need to randomly fall from the sky within the play area at the start of the game,
//TODO when the player drops it in the right container teleport cube into random location in the air.
//TODO Containers need to be randomly allocated a colour at the start of the game
//TODO As the timer goes down, the containers have a chance to switch renders/colours
//! When cube is dropped into the wrong container, the cube is teleported several times - Needs fix
public class Colours : MonoBehaviour public class Colours : MonoBehaviour
{ {
public bool done = false; public bool done = false;
// Start is called before the first frame update public GameObject[] boxes;
public int waitTime = 3;
private bool tp = false;
//*Start is called before the first frame update
void Start() void Start()
{ {
} }
// Update is called once per frame //*Update is called once per frame
void Update() void Update()
{ {
@ -20,10 +29,27 @@ public class Colours : MonoBehaviour
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
//*If the box is the same colour as the container, set done to true
if(other.gameObject.GetComponent<Renderer>().material.name == gameObject.GetComponentInParent<Renderer>().material.name && !done) if(other.gameObject.GetComponent<Renderer>().material.name == gameObject.GetComponentInParent<Renderer>().material.name && !done)
{ {
Debug.Log("YUM! Red is my favourite colour!");
done = true; done = true;
} }
else
{
//*If the box is not the same colour as the container, teleport the box
if(!tp)
{
tp = true;
StartCoroutine(BoxSpawn(other));
}
}
}
//*Teleport the box to a random location in the air
IEnumerator BoxSpawn(Collider other)
{
yield return new WaitForSeconds(waitTime);
other.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10));
} }
} }

View File

@ -12,18 +12,19 @@ public class Hamor : MonoBehaviour
public bool particles = false; public bool particles = false;
public TextMeshProUGUI scoreText; public TextMeshProUGUI scoreText;
public int score = 0; public int score = 0;
// Start is called before the first frame update public Moles_IsHit moles;
//*Start is called before the first frame update
void Start() void Start()
{ {
} }
// Update is called once per frame //*Update is called once per frame
void Update() void Update()
{ {
if(Input.GetMouseButtonDown(0)) if(Input.GetMouseButtonDown(0))
{ {
hamorAnimator.SetTrigger("Bonk"); hamorAnimator.SetTrigger("Bonk"); //*Play the bonk animation
} }
} }
@ -38,17 +39,26 @@ public class Hamor : MonoBehaviour
{ {
if(other.tag != "Player") if(other.tag != "Player")
{ {
var bitch = Instantiate(bonkParticles, contact.transform.position, Quaternion.identity); //*Play the bonk particles
Destroy(bitch, 1); var parLocation = Instantiate(bonkParticles, contact.transform.position, Quaternion.identity);
Destroy(parLocation, 1);
particles = true; particles = true;
StartCoroutine(BonkTimer()); StartCoroutine(BonkTimer());
} }
} }
if(other.gameObject.tag == "Mole") if(other.gameObject.tag == "Mole")
{
//*Get the Moles_IsHit script from the mole
moles = other.gameObject.GetComponent<Moles_IsHit>();
//*If the mole has not been hit, increase the score and change bool
if(moles.IsHit == false)
{ {
score += 1; score += 1;
scoreText.text = "Score: " + score.ToString(); scoreText.text = "Score: " + score.ToString();
moles.IsHit = true;
}
} }

View File

@ -1,17 +1,18 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using JetBrains.Annotations;
using Unity.VisualScripting; using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
//! Moles need to only let player hit them once and get only 1 point //TODO Moles need to change textures when hit to show they have been hit - need textures for this
//! Moles need to change textures when hit to show they have been hit - need textures for this //* As the time goes on, moles appear and disappear faster
public class Moles : MonoBehaviour public class Moles : MonoBehaviour
{ {
public GameObject hole1, hole2, hole3, hole4, hole5, hole6, hole7, hole8, hole9; public GameObject hole1, hole2, hole3, hole4, hole5, hole6, hole7, hole8, hole9;
public GameObject mole; public GameObject mole;
private float defaultSpeed = 10f; private float defaultSpeed = 10f;
public float lifeTime = 7.5f; public float lifeTime = 5f;
public bool moleCanAppear = false; public bool moleCanAppear = false;
public int randomHole, randomHole2, randomHole3; public int randomHole, randomHole2, randomHole3;
// Start is called before the first frame update // Start is called before the first frame update
@ -50,40 +51,41 @@ public class Moles : MonoBehaviour
switch (randomHole) switch (randomHole)
{ {
case 1: case 1:
var bitch = Instantiate(mole, hole1.transform.position, Quaternion.identity); var boxLocation = Instantiate(mole, hole1.transform.position, Quaternion.identity);
Destroy(bitch, lifeTime);
Destroy(boxLocation, lifeTime);
break; break;
case 2: case 2:
var bitch2 = Instantiate(mole, hole2.transform.position, Quaternion.identity); var boxLocation2 = Instantiate(mole, hole2.transform.position, Quaternion.identity);
Destroy(bitch2, lifeTime); Destroy(boxLocation2, lifeTime);
break; break;
case 3: case 3:
var bitch3 = Instantiate(mole, hole3.transform.position, Quaternion.identity); var boxLocation3 = Instantiate(mole, hole3.transform.position, Quaternion.identity);
Destroy(bitch3, lifeTime); Destroy(boxLocation3, lifeTime);
break; break;
case 4: case 4:
var bitch4 = Instantiate(mole, hole4.transform.position, Quaternion.identity); var boxLocation4 = Instantiate(mole, hole4.transform.position, Quaternion.identity);
Destroy(bitch4, lifeTime); Destroy(boxLocation4, lifeTime);
break; break;
case 5: case 5:
var bitch5 = Instantiate(mole, hole5.transform.position, Quaternion.identity); var boxLocation5 = Instantiate(mole, hole5.transform.position, Quaternion.identity);
Destroy(bitch5, lifeTime); Destroy(boxLocation5, lifeTime);
break; break;
case 6: case 6:
var bitch6 = Instantiate(mole, hole6.transform.position, Quaternion.identity); var boxLocation6 = Instantiate(mole, hole6.transform.position, Quaternion.identity);
Destroy(bitch6, lifeTime); Destroy(boxLocation6, lifeTime);
break;; break;;
case 7: case 7:
var bitch7 = Instantiate(mole, hole7.transform.position, Quaternion.identity); var boxLocation7 = Instantiate(mole, hole7.transform.position, Quaternion.identity);
Destroy(bitch7, lifeTime); Destroy(boxLocation7, lifeTime);
break; break;
case 8: case 8:
var bitch8 = Instantiate(mole, hole8.transform.position, Quaternion.identity); var boxLocation8 = Instantiate(mole, hole8.transform.position, Quaternion.identity);
Destroy(bitch8, lifeTime); Destroy(boxLocation8, lifeTime);
break; break;
case 9: case 9:
var bitch9 = Instantiate(mole, hole9.transform.position, Quaternion.identity); var boxLocation9 = Instantiate(mole, hole9.transform.position, Quaternion.identity);
Destroy(bitch9, lifeTime); Destroy(boxLocation9, lifeTime);
break; break;
} }
} }

View File

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Moles_IsHit : MonoBehaviour
{
public bool IsHit;
//*Start is called before the first frame update
void Start()
{
IsHit = false; //*Mole starts as not being hit
}
//*Update is called once per frame
void Update()
{
}
}

View File

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

View File

@ -37,7 +37,7 @@ public class Movement : MonoBehaviour
if (controller.isGrounded) if (controller.isGrounded)
{ {
moveDirection = new Vector3(right - left, 0, forwards - backwards); moveDirection = new Vector3(right - left, 0, forwards - backwards);
// Change the direction the player is facing based on the direction they are moving //* Change the direction the player is facing based on the direction they are moving
if (right - left != 0 || forwards - backwards != 0) if (right - left != 0 || forwards - backwards != 0)
{ {
Quaternion ToRotation = Quaternion.LookRotation(moveDirection); Quaternion ToRotation = Quaternion.LookRotation(moveDirection);
@ -49,20 +49,8 @@ public class Movement : MonoBehaviour
throwForce.throwForce = 4.0f; throwForce.throwForce = 4.0f;
} }
if (Input.GetKey(sprintKey))
{
moveDirection *= sprintSpeed;
jumpForce = 4.0f;
if(right - left != 0 || forwards - backwards != 0)
{
throwForce.throwForce = 20.0f;
}
}
else
{
moveDirection *= speed; moveDirection *= speed;
jumpForce = 2.5f; jumpForce = 2.5f;
}
if (Input.GetKeyDown(jumpKey)) if (Input.GetKeyDown(jumpKey))
{ {

20
Assets/Scripts/Timer.cs Normal file
View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class Timer : MonoBehaviour
{
public float timeRemaining;
public TextMeshProUGUI timeText;
//* Universal code for timers
void Update()
{
if (timeRemaining > 0)
{
timeRemaining -= Time.deltaTime;
timeText.text = timeRemaining.ToString("F0");
}
}
}

View File

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