Пример #1
0
        public InteractuableResult Interacted(PointerEventData eventData)
        {
            var result = InteractuableResult.IGNORES;

            if (isInteractive)
            {
                switch (((Item)Element).getBehaviour())
                {
                case Item.BehaviourType.FIRST_ACTION:
                {
                    var actions = Element.getActions().Checked();
                    if (actions.Any())
                    {
                        Game.Instance.Execute(new EffectHolder(actions.First().getEffects()));
                        result = InteractuableResult.DOES_SOMETHING;
                    }
                }
                break;

                case Item.BehaviourType.NORMAL:
                    var availableActions = Element.getActions().Valid(restrictedActions).Distinct().ToList();

                    ActionsUtil.AddExamineIfNotExists(Element, availableActions);

                    //if there is an action, we show them
                    if (availableActions.Count > 0)
                    {
                        Game.Instance.showActions(availableActions, Input.mousePosition, this);
                        result = InteractuableResult.DOES_SOMETHING;
                    }
                    break;

                case Item.BehaviourType.ATREZZO:
                default:
                    result = InteractuableResult.IGNORES;
                    break;
                }
            }

            return(result);
        }
Пример #2
0
        public InteractuableResult Interacted(PointerEventData pointerData = null)
        {
            InteractuableResult ret = InteractuableResult.IGNORES;

            if (interactable)
            {
                switch (GetBehaviourType())
                {
                case Item.BehaviourType.FIRST_ACTION:
                {
                    var actions = Element.getActions().Valid(AvailableActions);
                    lastActions = actions.ToList();
                    if (actions.Any())
                    {
                        ActionSelected(actions.First());
                        ret = InteractuableResult.DOES_SOMETHING;
                    }
                }
                break;

                case Item.BehaviourType.NORMAL:
                    var availableActions = Element.getActions().Valid(AvailableActions).Distinct().ToList();
                    ActionsUtil.AddExamineIfNotExists(Element, availableActions);
                    lastActions = availableActions;

                    //if there is an action, we show them
                    if (availableActions.Count > 0)
                    {
                        Game.Instance.showActions(availableActions, Input.mousePosition, this);
                        ret = InteractuableResult.DOES_SOMETHING;
                    }
                    break;

                default:
                    ret = InteractuableResult.IGNORES;
                    break;
                }
            }

            return(ret);
        }