示例#1
0
 public void ShowActions(AreaInteractable interactable)
 {
     if (OnShowActions != null)
     {
         OnShowActions(interactable);
     }
 }
示例#2
0
文件: AreaRoom.cs 项目: itsMaS/gamma
    public override bool Accept(AreaInteractable item, out string message)
    {
        message = "";
        return(false);

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

        return(base.Hover(item));
    }
示例#5
0
 public void Interact(AreaInteractable item)
 {
     if (Accept(item, out string no))
     {
         Interacted(item);
         item.Interact(this);
     }
     else
     {
         InteractDeny();
     }
 }
示例#6
0
 public virtual void Interact(AreaInteractable interactable)
 {
     currentInteractable = interactable;
     if (time > 0)
     {
         interactable.SetInteracting(true);
         GameManager.instance.StartTime(time, ActionFinished);
     }
     else
     {
         ActionFinished();
     }
 }
示例#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);
            }
        }
    }
示例#8
0
文件: AreaRoom.cs 项目: itsMaS/gamma
 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);
 }
示例#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);
     }
 }
示例#10
0
文件: AreaRoom.cs 项目: itsMaS/gamma
    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();
        }
    }
示例#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);
        }
    }
示例#12
0
 public virtual void Interacted(AreaInteractable item)
 {
 }
示例#13
0
 public virtual void ActionFinished()
 {
     AudioManager.Play("Complete");
     currentInteractable.SetInteracting(false);
     currentInteractable = null;
 }
示例#14
0
 public virtual bool Accept(AreaInteractable item, out string message)
 {
     message = "";
     return(true);
 }
示例#15
0
 public abstract bool Doable(AreaInteractable interactable, out string message);
示例#16
0
 public override bool Accept(AreaInteractable item, out string message)
 {
     return(action.Doable(item, out message));
 }
示例#17
0
 public override void Interacted(AreaInteractable item)
 {
     base.Interacted(item);
     interacted = true;
     action.Interact(item);
 }
示例#18
0
文件: AreaInfo.cs 项目: itsMaS/gamma
 public override bool Hover(AreaInteractable item)
 {
     //return base.Hover(item);
     return(false);
 }
示例#19
0
 public override void Interact(AreaInteractable interactable)
 {
     base.Interact(interactable);
 }
示例#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));
    }