//List<FoodItemTag> _currentRecipeIngredients = new List<FoodItemTag>(); //interact only true if the player is need to be working public override bool Interact(FoodItemTag item, rdEntity user) { if (user.ItemOnHand != FoodItemTag.None) { return(false); } //TODO player will manually picked what item user.ItemOnHand = IngredientsToPickedUp[0]; IngredientsToPickedUp.RemoveAt(0); if (IngredientsToPickedUp.Count <= 0) { Status = StationStatus.Inactive; } if (IngredientsToPickedUp.Count <= 0) { rdUIManager.UpdateStationPopups(gameObject); } else { rdUIManager.UpdateStationPopups(gameObject, IngredientsToPickedUp); } rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); rdRecipeManager.UpdateInstruction(user.ItemOnHand); return(false); }
public virtual void OnTriggerEnter2D(Collider2D collision) { GameObject go = collision.gameObject; rdEntity user = go.GetComponent <rdEntity>(); user.SelectedStation = this; }
public static void UpdateOnHandItem(FoodItemTag type, rdEntity entity) { if (Seele._foodBags.TryGetValue(type, out rdUIFoodBags fdbag)) { entity.ItemOnHandSprite.sprite = fdbag.Sprite; } else { entity.ItemOnHandSprite.sprite = null; } }
void StartTask(rdEntity user) { Timer += CurrentInstruction.ProcessTime; Status = StationStatus.Cooking; User = user; if (LoopSound.clip != null) { LoopSound.Play(); } StartSound.PlayAtPoint(transform.position); //play start sound and loop sound }
//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); }
public override bool Interact(FoodItemTag item, rdEntity user) { if (item == rdRecipeManager.Seele._currentRecipe.DishName) { rdRecipeManager.Seele.OrderServed(); Debug.Log(item + "served"); BellSound.PlayAtPoint(transform.position); user.ItemOnHand = FoodItemTag.None; rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); rdScoreSystem.Seele.OrderServed(); } else { //random chat thingyy ChatData[] chats = rdRecipeManager.Seele._currentChatdatas; rdUIManager.ShowRandomChatText(chats); return(false); } return(false); }
//TODO, restrict to put anything on unecessary on plates public override bool Interact(FoodItemTag item, rdEntity user) { switch (Status) { case StationStatus.Inactive: if (user.ItemOnHand == FoodItemTag.None) { return(false); } CurrentlyHolding.Add(user.ItemOnHand); user.DropOffItem(); bool correctDish = CurrentlyHolding.OrderBy(x => x).SequenceEqual(_requiredMenus.OrderBy(x => x)); //need to be checked again XD if (correctDish) { Status = StationStatus.Collect; FinalPlating = rdRecipeManager.Seele._currentRecipe.DishName; rdUIManager.UpdateStationPopups(this.gameObject, FinalPlating); rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); return(false); } rdUIManager.UpdateStationPopups(gameObject); rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); break; case StationStatus.Collect: CurrentlyHolding.Clear(); user.ItemOnHand = FinalPlating; ReadySound.PlayAtPoint(transform.position); Status = StationStatus.Inactive; rdUIManager.UpdateStationPopups(gameObject); rdUIManager.UpdateOnHandItem(user.ItemOnHand, user); break; default: break; } 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; }
public abstract bool Interact(FoodItemTag item, rdEntity user);
void Start() { _entity = GetComponent <rdEntity>(); }