All projects

We Are Cooked

A first-person zombie shooter and cooking game. Keep the customers fed while you hold off the zombies.

A cooking station with the prompt "Hold Interact to cook nugget (F)", the order timer, the current order and the customer's mood.

What I built

Zombies and waves, the tomato launcher, the shop, health and saving were written by teammates. Player movement was shared work.

How it works

Interaction system

Everything you can use in the kitchen goes through one base class. Interactable stores the prompt the player sees and, when useEvents is on, fires a UnityEvent before calling the object’s own Interact(). That way sounds or effects can be hooked onto a station in the Inspector without writing extra code.

Interactable.cs
public abstract class Interactable : MonoBehaviour
{
    public bool useEvents;
    public string promptMessage;

    public void BaseInteract(GameObject playerGameObject)
    {
        if (useEvents && TryGetComponent(out InteractionEvent interactionEvent))
            interactionEvent.OnInteract.Invoke();

        Interact(playerGameObject);
    }

    protected virtual void Interact(GameObject playerGameObject) { }
}

Pickup system

Each frame the player’s camera casts a ray on a pickable layer. An ingredient or food item under the crosshair gets a highlight; a second ray on a detectable layer shows the indicator on the nearest spawner or cooking station.

Picking something up parents it to a hold slot, makes its Rigidbody kinematic and hides the tomato launcher. While held, the item follows the camera with a lerp. Vertical movement lerps twice as fast as horizontal, so the item stays in view when you look up and down. The scroll wheel moves it closer or further away, clamped between a minimum and maximum distance. Dropping it gives physics back to the Rigidbody and brings the weapon back.

Cooking system

A CookingStation knows which recipe it makes. When the player interacts, it asks the IngredientManager to check the counter: a coroutine runs Physics.OverlapSphere every 0.5 seconds for up to 1.5 seconds, looking for the ingredients that recipe needs. Recipes are IngredientGroup entries in the Inspector (the required ingredients, how many of each, and the food prefab to spawn), loaded into a dictionary in Awake().

The station only listens through the small IIngredientCheckListener interface, so the manager doesn’t need to know what kind of station asked. If everything is there, the ingredients are removed and a five-second cooking routine starts. onCookingStarted and onCookingEnded UnityEvents go off for effects, and the finished food spawns with a Food component so the delivery system can recognise it.

Close-up of the deep fryer baskets with a nugget cooking and the crosshair above them.
IngredientManager.cs
IEnumerator IngredientCheckCoroutine(Ingredient.IngredientType type, Vector3 center,
                                     IIngredientCheckListener listener)
{
    float checkInterval = 0.5f;
    float timeout = 1.5f;
    float elapsed = 0f;

    while (elapsed < timeout)
    {
        if (CheckIngredientsInRadius(type, center))
        {
            listener?.OnIngredientsReady();
            yield break;
        }
        elapsed += checkInterval;
        yield return new WaitForSeconds(checkInterval);
    }

    listener?.OnIngredientsMissing();
}

Delivery system

When there’s no active order, a new one is generated: a random food type and a quantity of one to three. With the script’s default settings the time limit is 120 seconds plus 50 seconds for every extra item, capped at 300. The order UI shows one icon per item, a countdown and the customer’s mood.

The mood comes from the share of time left: 75% or more is happy, 50% neutral, 25% frustrated, and below that the customer is angry. Points per item drop with the mood, from 100 down to 25. When the player interacts at the counter, food of the right type within the counter’s detection radius is counted, and if there’s enough the order is completed and scored.

Register at the counter with the prompt "Interact to deliver packed food" and a bowl of nuggets next to it.
Delivering at the register. The customer status icon top left is the order's mood.
DeliverySystem.cs
public OrderState GetCurrentState(float happyThreshold, float neutralThreshold,
                                  float frustratedThreshold)
{
    float timeRemainingPercentage = GetTimeRemainingPercentage();

    if (timeRemainingPercentage >= happyThreshold)      return OrderState.Happy;
    else if (timeRemainingPercentage >= neutralThreshold) return OrderState.Neutral;
    else if (timeRemainingPercentage >= frustratedThreshold) return OrderState.Frustrated;
    else return OrderState.Angry;
}

Challenges and solutions

Clearing ingredients a player is still holding

Problem

Starting a recipe destroys the ingredients in range. A player could still be holding one of them, which would leave their pickup script pointing at a destroyed object with the weapon hidden.

What I did

Before destroying an ingredient, the station goes through every object tagged Player and clears that player’s held item, resets the holding state and shows the tomato launcher again.

How to play

ActionKeyboard & mouseController
Move WASDLeft stick
Shoot Left mouseR2 / LT
Pick up ER1 / RB
Interact with a station F△ / Y
Drop item QL1 / LB
Navigate menus ↑↓Enter

Play We Are Cooked now on itch.io (opens in a new tab)