Esempio n. 1
0
 public void ShowActions(AreaInteractable interactable)
 {
     if (OnShowActions != null)
     {
         OnShowActions(interactable);
     }
 }
Esempio n. 2
0
    public override bool Accept(AreaInteractable item, out string message)
    {
        message = "";
        return(false);

        return(base.Accept(item, out message));
    }
Esempio n. 3
0
    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));
    }
Esempio n. 4
0
    public override bool Hover(AreaInteractable item)
    {
        visual.InflateMessage();
        if (current && this != current)
        {
            current.Unhover();
        }
        current = this;

        return(base.Hover(item));
    }
Esempio n. 5
0
 public void Interact(AreaInteractable item)
 {
     if (Accept(item, out string no))
     {
         Interacted(item);
         item.Interact(this);
     }
     else
     {
         InteractDeny();
     }
 }
Esempio n. 6
0
 public virtual void Interact(AreaInteractable interactable)
 {
     currentInteractable = interactable;
     if (time > 0)
     {
         interactable.SetInteracting(true);
         GameManager.instance.StartTime(time, ActionFinished);
     }
     else
     {
         ActionFinished();
     }
 }
Esempio n. 7
0
    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);
            }
        }
    }
Esempio n. 8
0
 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);
 }
Esempio n. 9
0
 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);
     }
 }
Esempio n. 10
0
    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();
        }
    }
Esempio n. 11
0
    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);
        }
    }
Esempio n. 12
0
 public virtual void Interacted(AreaInteractable item)
 {
 }
Esempio n. 13
0
 public virtual void ActionFinished()
 {
     AudioManager.Play("Complete");
     currentInteractable.SetInteracting(false);
     currentInteractable = null;
 }
Esempio n. 14
0
 public virtual bool Accept(AreaInteractable item, out string message)
 {
     message = "";
     return(true);
 }
Esempio n. 15
0
 public abstract bool Doable(AreaInteractable interactable, out string message);
Esempio n. 16
0
 public override bool Accept(AreaInteractable item, out string message)
 {
     return(action.Doable(item, out message));
 }
Esempio n. 17
0
 public override void Interacted(AreaInteractable item)
 {
     base.Interacted(item);
     interacted = true;
     action.Interact(item);
 }
Esempio n. 18
0
 public override bool Hover(AreaInteractable item)
 {
     //return base.Hover(item);
     return(false);
 }
Esempio n. 19
0
 public override void Interact(AreaInteractable interactable)
 {
     base.Interact(interactable);
 }
Esempio n. 20
0
    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));
    }