Compare commits
No commits in common. "16784160a1ec4bc19fddff593760295e0b17ef6c" and "d37e365d0ecfa18fe39d5491035c6e080ac422bd" have entirely different histories.
16784160a1
...
d37e365d0e
BIN
Assets/Bomb.fbx
BIN
Assets/Bomb.fbx
Binary file not shown.
@ -1,107 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ed385ecca27c7e24daaba2285de11715
|
|
||||||
ModelImporter:
|
|
||||||
serializedVersion: 21300
|
|
||||||
internalIDToNameTable: []
|
|
||||||
externalObjects: {}
|
|
||||||
materials:
|
|
||||||
materialImportMode: 2
|
|
||||||
materialName: 0
|
|
||||||
materialSearch: 1
|
|
||||||
materialLocation: 1
|
|
||||||
animations:
|
|
||||||
legacyGenerateAnimations: 4
|
|
||||||
bakeSimulation: 0
|
|
||||||
resampleCurves: 1
|
|
||||||
optimizeGameObjects: 0
|
|
||||||
removeConstantScaleCurves: 1
|
|
||||||
motionNodeName:
|
|
||||||
rigImportErrors:
|
|
||||||
rigImportWarnings:
|
|
||||||
animationImportErrors:
|
|
||||||
animationImportWarnings:
|
|
||||||
animationRetargetingWarnings:
|
|
||||||
animationDoRetargetingWarnings: 0
|
|
||||||
importAnimatedCustomProperties: 0
|
|
||||||
importConstraints: 0
|
|
||||||
animationCompression: 1
|
|
||||||
animationRotationError: 0.5
|
|
||||||
animationPositionError: 0.5
|
|
||||||
animationScaleError: 0.5
|
|
||||||
animationWrapMode: 0
|
|
||||||
extraExposedTransformPaths: []
|
|
||||||
extraUserProperties: []
|
|
||||||
clipAnimations: []
|
|
||||||
isReadable: 0
|
|
||||||
meshes:
|
|
||||||
lODScreenPercentages: []
|
|
||||||
globalScale: 1
|
|
||||||
meshCompression: 0
|
|
||||||
addColliders: 0
|
|
||||||
useSRGBMaterialColor: 1
|
|
||||||
sortHierarchyByName: 1
|
|
||||||
importVisibility: 1
|
|
||||||
importBlendShapes: 1
|
|
||||||
importCameras: 1
|
|
||||||
importLights: 1
|
|
||||||
nodeNameCollisionStrategy: 1
|
|
||||||
fileIdsGeneration: 2
|
|
||||||
swapUVChannels: 0
|
|
||||||
generateSecondaryUV: 0
|
|
||||||
useFileUnits: 1
|
|
||||||
keepQuads: 0
|
|
||||||
weldVertices: 1
|
|
||||||
bakeAxisConversion: 0
|
|
||||||
preserveHierarchy: 0
|
|
||||||
skinWeightsMode: 0
|
|
||||||
maxBonesPerVertex: 4
|
|
||||||
minBoneWeight: 0.001
|
|
||||||
optimizeBones: 1
|
|
||||||
meshOptimizationFlags: -1
|
|
||||||
indexFormat: 0
|
|
||||||
secondaryUVAngleDistortion: 8
|
|
||||||
secondaryUVAreaDistortion: 15.000001
|
|
||||||
secondaryUVHardAngle: 88
|
|
||||||
secondaryUVMarginMethod: 1
|
|
||||||
secondaryUVMinLightmapResolution: 40
|
|
||||||
secondaryUVMinObjectScale: 1
|
|
||||||
secondaryUVPackMargin: 4
|
|
||||||
useFileScale: 1
|
|
||||||
strictVertexDataChecks: 0
|
|
||||||
tangentSpace:
|
|
||||||
normalSmoothAngle: 60
|
|
||||||
normalImportMode: 0
|
|
||||||
tangentImportMode: 3
|
|
||||||
normalCalculationMode: 4
|
|
||||||
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
|
|
||||||
blendShapeNormalImportMode: 1
|
|
||||||
normalSmoothingSource: 0
|
|
||||||
referencedClips: []
|
|
||||||
importAnimation: 1
|
|
||||||
humanDescription:
|
|
||||||
serializedVersion: 3
|
|
||||||
human: []
|
|
||||||
skeleton: []
|
|
||||||
armTwist: 0.5
|
|
||||||
foreArmTwist: 0.5
|
|
||||||
upperLegTwist: 0.5
|
|
||||||
legTwist: 0.5
|
|
||||||
armStretch: 0.05
|
|
||||||
legStretch: 0.05
|
|
||||||
feetSpacing: 0
|
|
||||||
globalScale: 1
|
|
||||||
rootMotionBoneName:
|
|
||||||
hasTranslationDoF: 0
|
|
||||||
hasExtraRoot: 0
|
|
||||||
skeletonHasParents: 1
|
|
||||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
|
||||||
autoGenerateAvatarMappingIfUnspecified: 1
|
|
||||||
animationType: 2
|
|
||||||
humanoidOversampling: 1
|
|
||||||
avatarSetup: 0
|
|
||||||
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
|
|
||||||
remapMaterialsIfMaterialImportModeIsNone: 0
|
|
||||||
additionalBone: 0
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d3484eb6347b8da47be5172c6d60f8ee
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e325d480dc98dca4d9aab6752b181583
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,63 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using TMPro;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//TODO Create Catch Game:
|
|
||||||
//* Objects constantly and randomly spawn in the air
|
|
||||||
//* Player must catch (just touch) the objects before they hit the ground
|
|
||||||
//* The player has a score that increases by 1 for each object caught
|
|
||||||
//* The player has a timer that counts down from 60 seconds
|
|
||||||
//* The game ends when the timer reaches 0
|
|
||||||
//TODO Some objects are worth more points than others and fall faster
|
|
||||||
//TODO Some objects are bombs and will decrease the player's score if in radius
|
|
||||||
//TODO Objects smash on the ground if not caught, create particles
|
|
||||||
|
|
||||||
public class BoxTP_Catch : MonoBehaviour
|
|
||||||
{
|
|
||||||
public GameObject[] objects;
|
|
||||||
public TextMeshProUGUI scoreText;
|
|
||||||
public float defaultSpeed = 1.5f;
|
|
||||||
public float timerSpeed;
|
|
||||||
public Timer timer;
|
|
||||||
public bool canSpawn = true;
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
scoreText.text = "Score: 0";
|
|
||||||
}
|
|
||||||
|
|
||||||
void FixedUpdate() {
|
|
||||||
|
|
||||||
timerSpeed = defaultSpeed * (timer.timeRemaining/60);
|
|
||||||
|
|
||||||
//spawn object a random object from the list every few seconds, randomly on the x and z axis
|
|
||||||
//if the object is not caught, destroy it
|
|
||||||
//if the object is caught, increase score by 1
|
|
||||||
if(timer.timeRemaining-1 > 0)
|
|
||||||
{
|
|
||||||
if (canSpawn) {
|
|
||||||
GameObject currentObject = Instantiate(objects[Random.Range(0, objects.Length)], new Vector3(Random.Range(5f, -5f), 15,- Random.Range(-5f, 5f)), Quaternion.identity);
|
|
||||||
currentObject.GetComponent<Rigidbody>().useGravity = true;
|
|
||||||
canSpawn = false;
|
|
||||||
StartCoroutine(SpawnTimer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator SpawnTimer() {
|
|
||||||
yield return new WaitForSeconds(timerSpeed);
|
|
||||||
canSpawn = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other) {
|
|
||||||
if(other.gameObject.tag == "PickupObject" || other.gameObject.tag == "Bomb" || other.gameObject.tag == "SpecialObject")
|
|
||||||
{
|
|
||||||
Destroy(other.gameObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e4a9d33dc4475534295840d4e1ef1fb2
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,46 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using TMPro;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//* Fix objects giving the player double points
|
|
||||||
public class Catch : MonoBehaviour
|
|
||||||
{
|
|
||||||
public int score;
|
|
||||||
public TextMeshProUGUI scoreText;
|
|
||||||
public Movement movement;
|
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other) {
|
|
||||||
if(other.gameObject.tag == "PickupObject")
|
|
||||||
{
|
|
||||||
Destroy(other.gameObject);
|
|
||||||
score = score + 1;
|
|
||||||
scoreText.text = "Score: " + score;
|
|
||||||
}
|
|
||||||
else if(other.gameObject.tag == "Bomb")
|
|
||||||
{
|
|
||||||
Destroy(other.gameObject);
|
|
||||||
score = score - 3;
|
|
||||||
scoreText.text = "Score: " + score;
|
|
||||||
StartCoroutine(ConcussionTime());
|
|
||||||
}
|
|
||||||
else if(other.gameObject.tag == "SpecialObject")
|
|
||||||
{
|
|
||||||
Destroy(other.gameObject);
|
|
||||||
score = score + 2;
|
|
||||||
scoreText.text = "Score: " + score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator ConcussionTime()
|
|
||||||
{
|
|
||||||
movement.speed = 0;
|
|
||||||
yield return new WaitForSeconds(2);
|
|
||||||
movement.speed = 7.0f;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 237a5c4f431d32d4a9b1d8b5bc9cf74e
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,24 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//TODO Increase the gravity of the object attached to this script
|
|
||||||
public class CubeGravity : MonoBehaviour
|
|
||||||
{
|
|
||||||
// Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void FixedUpdate()
|
|
||||||
{
|
|
||||||
GetComponent<Rigidbody>().AddForce(Physics.gravity *1.75f, ForceMode.Acceleration);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 6ccdb916f3e54634b9b549113921c189
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,20 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
|
|
||||||
public class TouchFloor : MonoBehaviour
|
|
||||||
{
|
|
||||||
void OnCollisionEnter(Collision collision)
|
|
||||||
{
|
|
||||||
if (collision.gameObject.tag == "Floor")
|
|
||||||
{
|
|
||||||
Destroy(gameObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ea5d73ce2fa80d64ca090ef4cffa6192
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -5,7 +5,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class Movement : MonoBehaviour
|
public class Movement : MonoBehaviour
|
||||||
{
|
{
|
||||||
public float speed = 7.0f;
|
public float speed = 5.0f;
|
||||||
public float turnSpeed;
|
public float turnSpeed;
|
||||||
public float sprintSpeed = 10.0f;
|
public float sprintSpeed = 10.0f;
|
||||||
public float jumpForce;
|
public float jumpForce;
|
||||||
@ -57,17 +57,6 @@ public class Movement : MonoBehaviour
|
|||||||
{
|
{
|
||||||
moveDirection.y = jumpForce;
|
moveDirection.y = jumpForce;
|
||||||
}
|
}
|
||||||
//If player is moving diagonally, reduce speed
|
|
||||||
if (forwards != 0 && right != 0 || forwards != 0 && left != 0 || backwards != 0 && right != 0 || backwards != 0 && left != 0)
|
|
||||||
{
|
|
||||||
moveDirection *= 0.7f;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
moveDirection *= 1.0f;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hammer)
|
if(hammer)
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 538bbdd32a2048441a276e500d2f5f18
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,56 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using TMPro;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
public class BoxTeleport_Sort : MonoBehaviour
|
|
||||||
{
|
|
||||||
private GameObject currentContainer;
|
|
||||||
public int waitTime = 3;
|
|
||||||
public TextMeshProUGUI scoreText;
|
|
||||||
private int score;
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
scoreText.text = "Score: 0";
|
|
||||||
}
|
|
||||||
private void OnTriggerEnter(Collider other)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(other.gameObject.tag == "Container")
|
|
||||||
{
|
|
||||||
currentContainer = other.gameObject;
|
|
||||||
//* If the box is not the same colour as the container, teleport the box after a few seconds
|
|
||||||
if(currentContainer.gameObject.GetComponentInParent<Renderer>().material.name == gameObject.GetComponent<Renderer>().material.name)
|
|
||||||
{
|
|
||||||
StartCoroutine(BoxSpawnCorrectDelay());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
StartCoroutine(BoxSpawnDIncorrectDelay());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator BoxSpawnCorrectDelay()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(.5f);
|
|
||||||
gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10));
|
|
||||||
score =+ 1;
|
|
||||||
scoreText.text = "Score: " + score;
|
|
||||||
}
|
|
||||||
|
|
||||||
//* Teleport the box to a random location in the air
|
|
||||||
IEnumerator BoxSpawnDIncorrectDelay()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(waitTime);
|
|
||||||
gameObject.transform.position = new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: b82d7abf31c7ee246af2125333411a70
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,33 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using Unity.VisualScripting;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
public class Colours : MonoBehaviour
|
|
||||||
{
|
|
||||||
public GameObject Box;
|
|
||||||
public GameObject[] containers;
|
|
||||||
public List<Material> materials = new List<Material>();
|
|
||||||
private GameObject currentBox;
|
|
||||||
private int num;
|
|
||||||
//* Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
//* Instantiate 8 containers with random colours at the start of the game
|
|
||||||
for (int i = 0; i < containers.Length; i++)
|
|
||||||
{
|
|
||||||
currentBox = Instantiate(Box, new Vector3(Random.Range(10, -10), 15, Random.Range(-10, 10)), Quaternion.identity);
|
|
||||||
num = Random.Range(0, materials.Count);
|
|
||||||
currentBox.GetComponent<Renderer>().material = materials[num];
|
|
||||||
containers[i].GetComponent<Renderer>().material = materials[num];
|
|
||||||
materials.RemoveAt(num);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f07fa7e7d67ec954ca9474c2da335e60
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,101 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Unity.VisualScripting;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Animations;
|
|
||||||
using UnityEngine.UIElements;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//! Somtimes boxes get thrown further than other times. Boxes also sometimes get thrown into random directions.
|
|
||||||
public class PickUpObject : MonoBehaviour
|
|
||||||
{
|
|
||||||
public GameObject carryPosition; // blank object, position declares where the object will be teleported to/carried
|
|
||||||
public bool insideTrigger = false; // checks if player is inside the trigger of a pickup object
|
|
||||||
public bool playerIsCarrying = false; // checks if player is carrying an object
|
|
||||||
public GameObject nearestCarriableObject;
|
|
||||||
public GameObject previousObject; // previous object that player was carrying
|
|
||||||
public GameObject heldObject; // object that player is currently holding
|
|
||||||
public float throwForce;
|
|
||||||
/// <summary>
|
|
||||||
/// Cooldown time between picking up objects in seconds
|
|
||||||
/// </summary>
|
|
||||||
public float cooldownSeconds = 1;
|
|
||||||
public bool cooldownActive = true;
|
|
||||||
public KeyCode interactKey = KeyCode.F;
|
|
||||||
|
|
||||||
// Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
// * Cubes are quite hot so need time to cool off
|
|
||||||
cooldownSeconds -= Time.deltaTime;
|
|
||||||
cooldownActive = cooldownSeconds > 0;
|
|
||||||
|
|
||||||
// * Old objects deserve gravity too
|
|
||||||
if(previousObject != null && previousObject.GetComponent<Rigidbody>().useGravity == false)
|
|
||||||
{
|
|
||||||
previousObject.GetComponent<Rigidbody>().useGravity = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(insideTrigger && Input.GetKeyDown(KeyCode.F) && !cooldownActive)
|
|
||||||
{
|
|
||||||
// * Who needs gravity
|
|
||||||
nearestCarriableObject.GetComponent<Rigidbody>().useGravity = false;
|
|
||||||
playerIsCarrying = true;
|
|
||||||
heldObject = nearestCarriableObject;
|
|
||||||
cooldownSeconds = 1;
|
|
||||||
}
|
|
||||||
// * YEET
|
|
||||||
else if(playerIsCarrying && Input.GetKeyDown(KeyCode.F))
|
|
||||||
{
|
|
||||||
heldObject.GetComponent<Rigidbody>().useGravity = true;
|
|
||||||
previousObject = heldObject;
|
|
||||||
playerIsCarrying = false;
|
|
||||||
previousObject.GetComponent<Rigidbody>().AddForce(transform.forward * throwForce, ForceMode.Impulse);
|
|
||||||
Debug.Log("Yoted!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// * Cubes not stored above heads are highly dangerous
|
|
||||||
if(playerIsCarrying)
|
|
||||||
{
|
|
||||||
nearestCarriableObject.transform.position = carryPosition.transform.position;
|
|
||||||
nearestCarriableObject.transform.rotation = carryPosition.transform.rotation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//* Called when the player is inside a trigger tagged as PickupObject
|
|
||||||
void OnTriggerStay(Collider otherObject)
|
|
||||||
{
|
|
||||||
if(otherObject.gameObject.tag == "PickupObject" && !cooldownActive)
|
|
||||||
{
|
|
||||||
nearestCarriableObject = otherObject.gameObject;
|
|
||||||
insideTrigger = true;
|
|
||||||
// * old cube is boring
|
|
||||||
if(heldObject != null && heldObject != nearestCarriableObject && playerIsCarrying)
|
|
||||||
{
|
|
||||||
previousObject = heldObject;
|
|
||||||
cooldownSeconds = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//* If player is not inside trigger, then they probably aren't inside it
|
|
||||||
void OnTriggerExit(Collider otherObject)
|
|
||||||
{
|
|
||||||
if(otherObject.gameObject.tag == "PickupObject")
|
|
||||||
{
|
|
||||||
insideTrigger = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//! To make player launch self:
|
|
||||||
//! add public GameObject player; and place player in it fron inspector
|
|
||||||
//! in if(insiderTrigger && Input.GetKeyDown(KeyCode.F))
|
|
||||||
//! Place the code below:
|
|
||||||
//! player.GetComponent<Rigidbody>().AddForce(transform.forward * throwForce, ForceMode.Impulse);
|
|
||||||
//! Run the game and press F to launch the player
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: eca94ba4e2f880644ab196f816624ee6
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,8 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ff9f43726664c7948b2c9e8d6ebdadea
|
|
||||||
folderAsset: yes
|
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,80 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Dynamic;
|
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//* Prevent player from moving when they are hitting the moles
|
|
||||||
public class Hamor : MonoBehaviour
|
|
||||||
{
|
|
||||||
public Animator hamorAnimator;
|
|
||||||
public GameObject bonkParticles;
|
|
||||||
public GameObject contact;
|
|
||||||
public bool particles = false;
|
|
||||||
public TextMeshProUGUI scoreText;
|
|
||||||
public int score = 0;
|
|
||||||
public Moles_IsHit moles;
|
|
||||||
public Movement movement;
|
|
||||||
//* Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//* Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if(Input.GetMouseButtonDown(0))
|
|
||||||
{
|
|
||||||
movement.hammer = true;
|
|
||||||
hamorAnimator.SetTrigger("Bonk"); //* Play the bonk animation
|
|
||||||
StartCoroutine(MoveTimer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator MoveTimer()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(1);
|
|
||||||
movement.hammer = false;
|
|
||||||
}
|
|
||||||
IEnumerator BonkTimer()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(1);
|
|
||||||
particles = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnTriggerEnter(Collider other) {
|
|
||||||
if(particles == false)
|
|
||||||
{
|
|
||||||
if(other.tag != "Player")
|
|
||||||
{
|
|
||||||
//* Play the bonk particles
|
|
||||||
var parLocation = Instantiate(bonkParticles, contact.transform.position, Quaternion.identity);
|
|
||||||
Destroy(parLocation, 1);
|
|
||||||
particles = true;
|
|
||||||
StartCoroutine(BonkTimer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
scoreText.text = "Score: " + score.ToString();
|
|
||||||
moles.IsHit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 388458319b483a949a166a07083c9590
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,110 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Unity.VisualScripting;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
//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
|
|
||||||
//* 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
|
|
||||||
|
|
||||||
public class Moles : MonoBehaviour
|
|
||||||
{
|
|
||||||
public GameObject hole1, hole2, hole3, hole4, hole5, hole6, hole7, hole8, hole9;
|
|
||||||
public GameObject mole;
|
|
||||||
private float defaultSpeed = 10f;
|
|
||||||
public float timerSpeed;
|
|
||||||
public float lifeTime = 4f;
|
|
||||||
public float timerlifeTime;
|
|
||||||
public bool moleCanAppear = false;
|
|
||||||
public int randomHole, randomHole2, randomHole3;
|
|
||||||
public Timer timer;
|
|
||||||
//* Start is called before the first frame update
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
moleCanAppear = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//* Update is called once per frame
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
timerSpeed = defaultSpeed * (timer.timeRemaining/120);
|
|
||||||
timerlifeTime = lifeTime * (timer.timeRemaining/120);
|
|
||||||
if(moleCanAppear)
|
|
||||||
{
|
|
||||||
randomHole = Random.Range(1, 9);
|
|
||||||
randomHole2 = Random.Range(1, 9);
|
|
||||||
while(randomHole2 == randomHole)
|
|
||||||
{
|
|
||||||
randomHole2 = Random.Range(1, 9);
|
|
||||||
}
|
|
||||||
randomHole3 = Random.Range(1, 9);
|
|
||||||
while(randomHole3 == randomHole || randomHole3 == randomHole2)
|
|
||||||
{
|
|
||||||
randomHole3 = Random.Range(1, 9);
|
|
||||||
}
|
|
||||||
moleCanAppear = false;
|
|
||||||
holeSelection(randomHole);
|
|
||||||
holeSelection(randomHole2);
|
|
||||||
holeSelection(randomHole3);
|
|
||||||
StartCoroutine(MoleTimer());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void holeSelection(int randomHole)
|
|
||||||
{
|
|
||||||
//* Prevent the same hole from being selected twice
|
|
||||||
switch (randomHole)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
var boxLocation = Instantiate(mole, hole1.transform.position, Quaternion.identity);
|
|
||||||
|
|
||||||
Destroy(boxLocation, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
var boxLocation2 = Instantiate(mole, hole2.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation2, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
var boxLocation3 = Instantiate(mole, hole3.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation3, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
var boxLocation4 = Instantiate(mole, hole4.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation4, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
var boxLocation5 = Instantiate(mole, hole5.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation5, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
var boxLocation6 = Instantiate(mole, hole6.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation6, timerlifeTime);
|
|
||||||
break;;
|
|
||||||
case 7:
|
|
||||||
var boxLocation7 = Instantiate(mole, hole7.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation7, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
var boxLocation8 = Instantiate(mole, hole8.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation8, timerlifeTime);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
var boxLocation9 = Instantiate(mole, hole9.transform.position, Quaternion.identity);
|
|
||||||
Destroy(boxLocation9, timerlifeTime);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerator MoleTimer()
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(timerSpeed);
|
|
||||||
moleCanAppear = true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 2a05eee06c231ea4f849ab3415485fe1
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -1,28 +0,0 @@
|
|||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
//* General Comments or Finished Tasks
|
|
||||||
//TODO Tasks left to be done for game
|
|
||||||
//! Bugs or Issues
|
|
||||||
//? Questions or Suggestions
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: cd50fe78e80ef7046a1452af2b97de93
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@ -8,8 +8,6 @@ TagManager:
|
|||||||
- PickupObject
|
- PickupObject
|
||||||
- Mole
|
- Mole
|
||||||
- Container
|
- Container
|
||||||
- Bomb
|
|
||||||
- SpecialObject
|
|
||||||
layers:
|
layers:
|
||||||
- Default
|
- Default
|
||||||
- TransparentFX
|
- TransparentFX
|
||||||
|
Loading…
Reference in New Issue
Block a user