示例#1
0
        public override IInteraction[] GenerateInteractions(InteractionEvent interactionEvent)
        {
            OpenInteraction openInteraction = new OpenInteraction();

            openInteraction.OpenStateChange += OnOpenStateChange;
            return(new IInteraction[] { openInteraction });
        }
示例#2
0
        public override IInteraction[] GenerateInteractionsFromTarget(InteractionEvent interactionEvent)
        {
            // Here we generate the interactions when we are not holding the item
            OpenInteraction openInteraction = new OpenInteraction();

            openInteraction.icon = openInteractionIcon;
            // fires an event to tell the subscribers the state has been changed
            openInteraction.OpenStateChange += OnOpenStateChange;
            // returns the new interaction list
            return(new IInteraction[] { openInteraction });
        }
示例#3
0
        public override IInteraction[] GenerateInteractionsFromTarget(InteractionEvent interactionEvent)
        {
            if (containerDescriptor.hasCustomInteraction)
            {
                return(new IInteraction[0]);
            }

            List <IInteraction> interactions = new List <IInteraction>();

            StoreInteraction storeInteraction = new StoreInteraction(containerDescriptor);

            storeInteraction.icon = containerDescriptor.storeIcon;
            TakeInteraction takeInteraction = new TakeInteraction(containerDescriptor);

            takeInteraction.icon = containerDescriptor.takeIcon;
            ViewContainerInteraction view = new ViewContainerInteraction(containerDescriptor)
            {
                MaxDistance = containerDescriptor.maxDistance, icon = viewContainerIcon
            };

            view.icon = containerDescriptor.viewIcon;

            // Pile or Normal the Store Interaction will always appear, but View only appears in Normal containers
            if (IsOpen() | !containerDescriptor.onlyStoreWhenOpen | !containerDescriptor.isOpenable)
            {
                if (containerDescriptor.hasUi)
                {
                    interactions.Add(storeInteraction);
                    interactions.Add(view);
                }
                else
                {
                    interactions.Add(storeInteraction);
                    interactions.Add(takeInteraction);
                }
            }

            if (containerDescriptor.isOpenable)
            {
                OpenInteraction openInteraction = new OpenInteraction(containerDescriptor);
                openInteraction.icon             = containerDescriptor.openIcon;
                openInteraction.OpenStateChange += OnOpenStateChange;
                interactions.Add(openInteraction);
            }

            return(interactions.ToArray());
        }