: Unity, : C#, : JetBrains Rider, : 9 weeks, : School, : 5 people
In this project I worked with 4 other students. We were allowed to make our own groups for this project. The time we had for this project was 9 weeks. The theme of the project was to make a puzzle game in 3 rooms with a parameter of 10x10x10. We decided on base of references from other games how the game was going to look. We decided to get a relaxed art style from Japan like a temple. After we have decided the art style we went to go to smaller groups and discuss what we needed. Such as: are we going to move the player or how are we going to make the puzzles work? After that we were going to assign tasks to each other. And we did give each other 2x a day updates because of the scrum methode.
What did I learn in this project?
I have learned how to make a Pitch-deck, how to make a game more realistic by doing research before we started the real project. Being able to work in with pro builder for a blockout. and think about how we can make a game in a small place. Making a tool for the game artists.
What did I do in this project?
I got the following tasks: Make a tool for the game artists, Sound Manager, Main Menu, Puzzle Manager, Puzzle scripts, Door Script, Automatic door Opening, Post processing to change the warmth feel of the game.
Code snippets
PickUp script
public class PlayerPickUp : MonoBehaviour
{
private PickUpItem _pickable;
public GameObject playerHands;
public Transform raycastPoint;
public float raycastMaxDistance;
public KeyInventory keyInventory;
public UnityEvent onItemPickup;
private InputManager _input;
[Header("Sounds")]
[SerializeField] private SoundManager soundManager;
[SerializeField] private string flutePickUpSound;
[SerializeField] private string keyPickUpSound;
private void Start()
{
_input = InputManager.instance;
}
private void Update()
{
if (_input.PickupItem())
{
TryPickUp();
}
}
private void TryPickUp()
{
if (_pickable)
{
DropPickedUpItem(_pickable);
}
else
{
RaycastHit hit;
if (Physics.Raycast(raycastPoint.position, raycastPoint.forward, out hit,raycastMaxDistance))
{
_pickable = hit.transform.GetComponent();
if (_pickable && _pickable.Flute)
{
soundManager.Play(flutePickUpSound);
_pickable.gameObject.SetActive(false);
}
else if (_pickable && !_pickable.Flute)
{
soundManager.Play(keyPickUpSound);
PickUpItem(_pickable);
}
}
}
}
private void DropPickedUpItem(PickUpItem item)
{
_pickable = null;
item.transform.SetParent(null);
if (item.GetComponent())
{
keyInventory.hasMainKey = false;
keyInventory.hasBasementKey = false;
keyInventory.hasGardenKey = false;
}
item.GetRigidbody.isKinematic = false;
item.GetRigidbody.AddForce(item.transform.forward * 3,ForceMode.VelocityChange);
}
private void PickUpItem(PickUpItem item)
{
item.GetRigidbody.isKinematic = true;
item.transform.parent = playerHands.transform;
item.transform.localPosition = Vector3.zero;
item.transform.localEulerAngles = Vector3.zero;
}
}
Open and Close door
public class Door : MonoBehaviour
{
public AnimationCurve openSpeedCurve = new AnimationCurve(new Keyframe[] { new Keyframe(0, 1, 0, 0), new Keyframe(0.8f, 1, 0, 0), new Keyframe(1, 0, 0, 0) });
public float openDistance = 0.58f; //How far should door slide (change direction by entering either a positive or a negative value)
public float openSpeedMultiplier = 1.0f; //Increasing this value will make the door open faster
public Transform doorLeft; //Door body Transform
public Transform doorRight;
private bool open = false;
private Vector3 defaultLeftDoorPosition;
private Vector3 currentLeftDoorPosition;
private Vector3 defaultRightDoorPosition;
private Vector3 currentRightDoorPosition;
private float openTime = 0;
[Header("Sound")]
[SerializeField] private SoundManager soundManager;
[SerializeField] private string soundName;
private void Start()
{
if (doorLeft && doorRight)
{
defaultLeftDoorPosition = doorLeft.localPosition;
defaultRightDoorPosition = doorRight.localPosition;
}
}
// Main function
private void Update()
{
if (!doorLeft&&!doorRight)
return;
if (openTime < 1)
{
openTime += Time.deltaTime * openSpeedMultiplier * openSpeedCurve.Evaluate(openTime);
}
doorLeft.localPosition = new Vector3(doorLeft.localPosition.x, doorLeft.localPosition.y, Mathf.Lerp(currentLeftDoorPosition.z, defaultLeftDoorPosition.z + (open ? openDistance : 0), openTime));
doorRight.localPosition = new Vector3(doorRight.localPosition.x, doorRight.localPosition.y, Mathf.Lerp(currentRightDoorPosition.z, defaultRightDoorPosition.z - (open ? openDistance : 0), openTime));
}
// Activate the Main function when Player enter the trigger area
private void OnTriggerEnter(Collider other)
{
if (other.GetComponent())
{
soundManager.Play(soundName);
open = true;
currentLeftDoorPosition = doorLeft.localPosition;
currentRightDoorPosition = doorRight.localPosition;
openTime = 0;
}
}
// Deactivate the Main function when Player exit the trigger area
private void OnTriggerExit(Collider other)
{
if (other.GetComponent())
{
open = false;
currentLeftDoorPosition = doorLeft.localPosition;
currentRightDoorPosition = doorRight.localPosition;
openTime = 0;
}
}
}
}
All the code from this project:
Github Code