WOOLLY RULE
Sep 30, 2023 - Group Project HKU - Unity C# - Role: Lead Developer
Sep 30, 2023 - Group Project HKU - Unity C# - Role: Lead Developer
Scissors.cs takes advantage of the fact that GetComponent can query for interfaces
We have an ICuttable interface which also holds information like if the "Woolly Rule" is broken on cut and / or if the cuttable should be ignored
Scissors has System.Actions for all the visual feedback classes to hook into
These are linked together via the GameManager which is allowed to know all
When a sheep is cut ( not sheered ), I use the UnityEvent OnCut to enable and detach the two pieces of the sheep with some rb.AddForce
The animation is done via lerping between two states using a sin wave, with help from artist Luke
The sheep randomly rotates every random interval and always moves forward
All sheep and cows are drawn to the center of the planet
The camera, and therefore the scissors the background and the button all rotate around the center of the planet
All physics objects have to use PlanetGravity.cs in order to work correctly
With https://discussions.unity.com/t/rotate-rigidbody-with-addtorque-towards-a-specific-location/792692/3 I was able to implement the self-center
Assignment: create a game inspired by some ancient culture from around the world. Ours was ancient Egypt. We decided to zoom in on the dogmatic rules around art and translated them into a silly game about cutting sheep in half ( literally ).
This project taught me to self-start and start early on prototyping. Here is the first iteration I made whereby you can split cubes in half. The team approved it.
Here I implemented the spherical planet gravity which enforces the game's lighthearted and cartoony vibe. We also implemented the scissor visual.
Here the sheep and cow models are implemented. We decided the make the animation work in-code because the effect it has was sufficient.
Putting it all together, we get the final product. -->
When you cut a cow or press the big red button ( break the RULE ) the game shows your own webcam and stops the music. This is a camp reimagining of affordance and "art rules" that cannot be broken.
☆ Here we see how the Scissors look for things that are ICuttable.
GetIsWarning() is for attaching to a System.Func<bool>. This is for wether or not the visual of the scissors should shake and text to flash red when the user is about to cut something that break THE RULE.
☆ This is Animal.cs ( sheep + cow )'s OnCut UnityEvent that splits the sheep in half in a dynamic way. This is what I like to call the Unity Event Composite Paradigm whereby the Unity editor basically serves as the "context" or "game manager" linking everything together.
private void FixedUpdate() // This is how the planet gravity works.
{
Vector3 gravity = (planet.position - transform.position).normalized * Physics.gravity.magnitude;
rb.AddForce(gravity, ForceMode.Acceleration);
if (standUprightTorque > 0f)
SelfCenter(gravity);
}
☆ This is my take on the GameManager class. Notice how it knows all the scripts in the game by name but it doesn't actually do anything. On the contrary, the worker scripts know nobody and do all the work.
The usage of FindAnyObjectByType makes it so that you don't have to drag and drop so much anymore.