public void ShowActions(AreaInteractable interactable) { if (OnShowActions != null) { OnShowActions(interactable); } }
public override bool Accept(AreaInteractable item, out string message) { message = ""; return(false); return(base.Accept(item, out message)); }
public override bool Doable(AreaInteractable interactable, out string message) { Person person = interactable as Person; if (person && person.Attributes[Person.AttributeTypes.Energy] > 50) { message = string.Format($"<color={GameAction.errorColor}>You are not tired [<sprite=1>>50]"); return(false); } return(base.Doable(interactable, out message)); }
public override bool Hover(AreaInteractable item) { visual.InflateMessage(); if (current && this != current) { current.Unhover(); } current = this; return(base.Hover(item)); }
public void Interact(AreaInteractable item) { if (Accept(item, out string no)) { Interacted(item); item.Interact(this); } else { InteractDeny(); } }
public virtual void Interact(AreaInteractable interactable) { currentInteractable = interactable; if (time > 0) { interactable.SetInteracting(true); GameManager.instance.StartTime(time, ActionFinished); } else { ActionFinished(); } }
public override void Interact(AreaInteractable interactable) { base.Interact(interactable); GameManager.MakePopup(lastNetResources, interactable.transform.position); Person person = interactable as Person; if (person) { person.progressBar.StartCount(time, this); foreach (var item in AttributeValues) { person.Attributes[item.type] = Mathf.Clamp(person.Attributes[item.type] + item.netAmount, 0, 100); } } }
public override bool Hover(AreaInteractable item) { if (areaInfo) { areaInfo.Show(); } foreach (var action in Actions) { if (item.gameObject.activeInHierarchy) { action.Show(); } } an.SetBool("Empty", true); return(true); }
public virtual bool Hover(AreaInteractable item) { an.SetBool("Hover", true); if (an.GetBool("Hover")) { } if (Accept(item, out string mesg)) { visual.SetAreaMessage(mesg); HoverAccept(); return(true); } else { visual.SetAreaMessage(mesg); HoverDeny(); return(false); } }
public virtual void OnShow(AreaInteractable interactable) { bool areaUsed = false; foreach (var item in Actions) { foreach (var group in interactable.ActionGroups) { if (group.AvailableActions.Contains(item.action)) { item.EnableSelf(); item.action.Initialize(this, item); item.UpdateLayout(); areaUsed = true; } } } if (areaUsed) { Show(); } }
public override bool Doable(AreaInteractable interactable, out string message) { currentInteractable = interactable; Person person = interactable as Person; if (person) { bool check = true; message = ""; foreach (var item in AttributeValues) { if (!MakeString(ref message, person.Attributes[item.type], item.netAmount, Person.AttributeIconCodes[item.type])) { check = false; } } lastNetResources = message; message += string.Format($"<color={GameAction.okColor}> {time}{"<sprite=3>"} "); if (!check) { message = string.Format($"<color={GameAction.okColor}>You're missing resources! \n {message}"); return(false); } else { message = string.Format($"<color={GameAction.okColor}>{actionDescription}\n") + message; } return(true); } else { message = string.Format($"<color={GameAction.errorColor}>Object is not a person"); return(false); } }
public virtual void Interacted(AreaInteractable item) { }
public virtual void ActionFinished() { AudioManager.Play("Complete"); currentInteractable.SetInteracting(false); currentInteractable = null; }
public virtual bool Accept(AreaInteractable item, out string message) { message = ""; return(true); }
public abstract bool Doable(AreaInteractable interactable, out string message);
public override bool Accept(AreaInteractable item, out string message) { return(action.Doable(item, out message)); }
public override void Interacted(AreaInteractable item) { base.Interacted(item); interacted = true; action.Interact(item); }
public override bool Hover(AreaInteractable item) { //return base.Hover(item); return(false); }
public override void Interact(AreaInteractable interactable) { base.Interact(interactable); }
public override bool Doable(AreaInteractable interactable, out string message) { switch (actionType) { case Type.WashDishes: if (room.dishesWashed) { message = string.Format($"<color={GameAction.errorColor}>Dishes are already washed."); return(false); } break; case Type.EatMeal: if (room.meals <= 0) { message = string.Format($"<color={GameAction.errorColor}>There are no meals."); return(false); } if (!room.dishesWashed) { message = string.Format($"<color={GameAction.errorColor}>All the dishes are dirty."); return(false); } break; case Type.EatIngredients: AttributeValues.RemoveAll(e => (e.type == Person.AttributeTypes.Hunger)); Required req = new Required(); req.type = Person.AttributeTypes.Hunger; req.netAmount = room.CheckIngredientsConsumption(); if (req.netAmount <= 0) { message = string.Format($"<color={GameAction.errorColor}>No ingredients in the kitchen."); return(false); } AttributeValues.Add(req); break; case Type.PrepareMeal: if (room.meals >= room.maxMeals) { message = string.Format($"<color={GameAction.errorColor}>Meals are at full capacity. [{room.meals}/{room.maxMeals}]"); } if (room.ingredients < mealCost) { message = string.Format($"<color={GameAction.errorColor}>Not enough ingredients for a meal. [{room.ingredients}/{mealCost}]"); return(false); } break; case Type.AddIngredients: FoodIngredient ingredient = interactable as FoodIngredient; if (ingredient) { int waste; if ((waste = room.CheckIngredients(ingredient.nutritionValue)) > 0) { if (ingredient.nutritionValue - waste <= 0) { message = string.Format($"<color={GameAction.errorColor}>Full food ingredient capacity [{room.ingredients}/{room.maxIngredients}]"); return(false); } message = string.Format($"<color={GameAction.okColor}>{ingredient.foodName} +{ingredient.nutritionValue-waste} ingredients."); message += string.Format($"<color={GameAction.errorColor}> \n -{waste} Wasted"); } else { message = string.Format($"<color={GameAction.okColor}>{ingredient.foodName} +{ingredient.nutritionValue} food ingredients."); } return(true); } break; default: break; } return(base.Doable(interactable, out message)); }