// Update is called once per frame void Update() { if (m_doRun && !Done()) { m_chopTimer -= Time.deltaTime; if (Done()) { int pointsToAdd = Waiter.SubmitPlate(m_playerID, m_currentIngredientsMask); if (pointsToAdd <= 0) { Main.SendFloater(m_ingredientPos.transform.position, 2.0f, ("Failed and fed to the dogs")); Main.AUDIO_Wrong(); } ClearIngredients(); m_doRun = false; } } }
// Main decision maker void CheckAction(MY_GAME_INPUTS gi) { if (m_model == null) { return; } // Only allow action when stopped if (m_state != PLAYER_STATE.IDLE) { return; } // No model if (m_model == null) { return; } // User is calling for an action - Find the context and trigger it if (gi.trigger1) { // Always stop FullStop(); if (m_focusTrashCan != null) { Main.AUDIO_PutDown(); ClearIngredients(); return; } // If I have an ingredien, either drop it or put it on the table if (m_ingredients.Count >= cm_MAX_INGREDIENTS) { // If I have an ingredient no table, drop it if (m_focusChoppingTable != null) { // If I have an ingredient and a table, drop it on the table m_focusChoppingTable.AddIngredients(m_ingredients); ClearIngredients(); } else { Main.AUDIO_Wrong(); Main.SendFloater(m_model.transform.position + Vector3.up, 3.0f, ("Inventory Full")); } } // Can carry more ingredients else { if (m_focusIngredient != null) { ChangeState(PLAYER_STATE.TRANSFER); } else { // Start chopping with a table full of ingredients) if (m_ingredients.Count < 1 && m_focusChoppingTable != null && m_focusChoppingTable.HasIngredients()) { ChangeState(PLAYER_STATE.CHOPPING); } else { if (m_focusChoppingTable != null) { m_focusChoppingTable.AddIngredients(m_ingredients); ClearIngredients(); } } } } } }