//interact only true if the player is need to be working public override bool Interact(FoodItemTag item, rdEntity user) { switch (Status) { case StationStatus.Ready: foreach (RecipeInstruction rm in RecipeMenu) { foreach (FoodItemTag igts in rm.Ingredients) { if (igts == item) { user.DropOffItem(); CurrentInstruction = rm; rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); rdUIManager.UpdateStationPopups(this.gameObject); //TODO multiple cooks CurrentHoldItems.Add(igts); FoodItemTag[] reqs = CurrentInstruction.Ingredients; bool startCooking = CurrentHoldItems.OrderBy(x => x).SequenceEqual(reqs.OrderBy(x => x)); if (startCooking) { StartTask(user); } return(CurrentInstruction.Type == TaskType.Active); } } } break; case StationStatus.Collect: if (user.CollectItem(CurrentInstruction.Result)) { Status = StationStatus.Ready; } RecipeMenu.Remove(CurrentInstruction); CurrentHoldItems.Clear(); //OnHoldInstructionUpdate(); rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); rdUIManager.UpdateStationPopups(this.gameObject); rdRecipeManager.UpdateInstruction(user.ItemOnHand); break; default: return(false); } return(false); }
void TaskDone() { User.SendMessageToBrain((int)PlayerCommand.WorkDone); Debug.Log(CurrentInstruction.Result + " Done"); LoopSound.Stop(); if (CurrentInstruction.Type == TaskType.Active) { User.CollectItem(CurrentInstruction.Result); RecipeMenu.Remove(CurrentInstruction); CurrentHoldItems.Clear(); //OnHoldInstructionUpdate(); rdUIManager.UpdateOnHandItem(User.ItemOnHand, User); rdUIManager.UpdateStationPopups(this.gameObject); rdRecipeManager.UpdateInstruction(User.ItemOnHand); Status = StationStatus.Ready; } else { rdUIManager.UpdateStationPopups(this.gameObject, CurrentInstruction.Result); Status = StationStatus.Collect; } User = null; }