WhackAMole: Moles now descend when hit. Timer affects the speed of moles. TODO comments added, completed tasks removed
ColourSorting: Removed completed tasks from Colours, added Bug comment to pickup script
This commit is contained in:
parent
c39ff0c263
commit
170d11aa4d
@ -10,9 +10,6 @@ using UnityEngine;
|
|||||||
//! Bugs or Issues
|
//! Bugs or Issues
|
||||||
//? Questions or Suggestions
|
//? Questions or Suggestions
|
||||||
|
|
||||||
//* Cubes need to randomly fall from the sky within the play area at the start of the game,
|
|
||||||
//* when the player drops it in the right container teleport cube into random location in the air.
|
|
||||||
//* 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
|
//TODO As the timer goes down, the containers have a chance to switch renders/colours
|
||||||
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ using UnityEngine;
|
|||||||
//! Bugs or Issues
|
//! Bugs or Issues
|
||||||
//? Questions or Suggestions
|
//? Questions or Suggestions
|
||||||
|
|
||||||
|
//TODO Prevent player from moving when they are hitting the moles
|
||||||
public class Hamor : MonoBehaviour
|
public class Hamor : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Animator hamorAnimator;
|
public Animator hamorAnimator;
|
||||||
|
@ -11,15 +11,21 @@ using UnityEngine;
|
|||||||
|
|
||||||
//TODO Moles need to change textures when hit to show they have been hit - need textures for this
|
//TODO 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
|
//* As the time goes on, moles appear and disappear faster
|
||||||
|
//* Moles that are hit slowly move down into their hole
|
||||||
|
//TODO Ajust the speed of the moles appearing and disappearing based on the time remaining
|
||||||
|
//TODO Prevent player from moving when they are hitting the moles
|
||||||
|
|
||||||
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 = 5f;
|
public float timerSpeed;
|
||||||
|
public float lifeTime = 4f;
|
||||||
|
public float timerlifeTime;
|
||||||
public bool moleCanAppear = false;
|
public bool moleCanAppear = false;
|
||||||
public int randomHole, randomHole2, randomHole3;
|
public int randomHole, randomHole2, randomHole3;
|
||||||
|
public Timer timer;
|
||||||
//* Start is called before the first frame update
|
//* Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@ -29,6 +35,8 @@ public class Moles : MonoBehaviour
|
|||||||
//* Update is called once per frame
|
//* Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
timerSpeed = defaultSpeed * (timer.timeRemaining/120);
|
||||||
|
timerlifeTime = lifeTime * (timer.timeRemaining/120);
|
||||||
if(moleCanAppear)
|
if(moleCanAppear)
|
||||||
{
|
{
|
||||||
randomHole = Random.Range(1, 9);
|
randomHole = Random.Range(1, 9);
|
||||||
@ -58,46 +66,46 @@ public class Moles : MonoBehaviour
|
|||||||
case 1:
|
case 1:
|
||||||
var boxLocation = Instantiate(mole, hole1.transform.position, Quaternion.identity);
|
var boxLocation = Instantiate(mole, hole1.transform.position, Quaternion.identity);
|
||||||
|
|
||||||
Destroy(boxLocation, lifeTime);
|
Destroy(boxLocation, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
var boxLocation2 = Instantiate(mole, hole2.transform.position, Quaternion.identity);
|
var boxLocation2 = Instantiate(mole, hole2.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation2, lifeTime);
|
Destroy(boxLocation2, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var boxLocation3 = Instantiate(mole, hole3.transform.position, Quaternion.identity);
|
var boxLocation3 = Instantiate(mole, hole3.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation3, lifeTime);
|
Destroy(boxLocation3, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
var boxLocation4 = Instantiate(mole, hole4.transform.position, Quaternion.identity);
|
var boxLocation4 = Instantiate(mole, hole4.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation4, lifeTime);
|
Destroy(boxLocation4, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
var boxLocation5 = Instantiate(mole, hole5.transform.position, Quaternion.identity);
|
var boxLocation5 = Instantiate(mole, hole5.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation5, lifeTime);
|
Destroy(boxLocation5, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
var boxLocation6 = Instantiate(mole, hole6.transform.position, Quaternion.identity);
|
var boxLocation6 = Instantiate(mole, hole6.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation6, lifeTime);
|
Destroy(boxLocation6, timerlifeTime);
|
||||||
break;;
|
break;;
|
||||||
case 7:
|
case 7:
|
||||||
var boxLocation7 = Instantiate(mole, hole7.transform.position, Quaternion.identity);
|
var boxLocation7 = Instantiate(mole, hole7.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation7, lifeTime);
|
Destroy(boxLocation7, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
var boxLocation8 = Instantiate(mole, hole8.transform.position, Quaternion.identity);
|
var boxLocation8 = Instantiate(mole, hole8.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation8, lifeTime);
|
Destroy(boxLocation8, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
var boxLocation9 = Instantiate(mole, hole9.transform.position, Quaternion.identity);
|
var boxLocation9 = Instantiate(mole, hole9.transform.position, Quaternion.identity);
|
||||||
Destroy(boxLocation9, lifeTime);
|
Destroy(boxLocation9, timerlifeTime);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator MoleTimer()
|
IEnumerator MoleTimer()
|
||||||
{
|
{
|
||||||
yield return new WaitForSeconds(defaultSpeed);
|
yield return new WaitForSeconds(timerSpeed);
|
||||||
moleCanAppear = true;
|
moleCanAppear = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,10 @@ public class Moles_IsHit : MonoBehaviour
|
|||||||
//* Update is called once per frame
|
//* Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
if(IsHit)
|
||||||
|
{
|
||||||
|
//* Slowly move the mole down into the hole
|
||||||
|
transform.position = new Vector3(transform.position.x, transform.position.y - 0.01f, transform.position.z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using UnityEngine.UIElements;
|
|||||||
//! Bugs or Issues
|
//! Bugs or Issues
|
||||||
//? Questions or Suggestions
|
//? Questions or Suggestions
|
||||||
|
|
||||||
|
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
||||||
public class PickUpObject : MonoBehaviour
|
public class PickUpObject : MonoBehaviour
|
||||||
{
|
{
|
||||||
public GameObject carryPosition; // blank object, position declares where the object will be teleported to/carried
|
public GameObject carryPosition; // blank object, position declares where the object will be teleported to/carried
|
||||||
@ -72,7 +73,7 @@ public class PickUpObject : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the player is inside a trigger tagged as PickupObject
|
//* Called when the player is inside a trigger tagged as PickupObject
|
||||||
void OnTriggerStay(Collider otherObject)
|
void OnTriggerStay(Collider otherObject)
|
||||||
{
|
{
|
||||||
if(otherObject.gameObject.tag == "PickupObject" && !cooldownActive)
|
if(otherObject.gameObject.tag == "PickupObject" && !cooldownActive)
|
||||||
@ -88,7 +89,7 @@ public class PickUpObject : MonoBehaviour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If player is not inside trigger, then they probably aren't inside it
|
//* If player is not inside trigger, then they probably aren't inside it
|
||||||
void OnTriggerExit(Collider otherObject)
|
void OnTriggerExit(Collider otherObject)
|
||||||
{
|
{
|
||||||
if(otherObject.gameObject.tag == "PickupObject")
|
if(otherObject.gameObject.tag == "PickupObject")
|
||||||
|
Loading…
Reference in New Issue
Block a user