コード例 #1
0
ファイル: StorageContainer.cs プロジェクト: Ryan089/SS3D
        public override IInteraction[] GenerateInteractionsFromTarget(InteractionEvent interactionEvent)
        {
            // The "open" state is changed via the object interaction
            // so we don't need to worry about that here, unless we can store stuff without needing it to open

            List <IInteraction>      interactions     = new List <IInteraction>();
            StoreInteraction         storeInteraction = new StoreInteraction();
            TakeInteraction          takeInteraction  = new TakeInteraction();
            ViewContainerInteraction view             = new ViewContainerInteraction {
                MaxDistance = MaxDistance, icon = viewContainerIcon
            };

            switch (StorageType)
            {
            // Normal Containers don't have a Take Interaction since their UI can be opened
            case ContainerType.Normal:
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, view);
                break;

            // Pile Containers don't have an UI, the only way to pick up items is taking one by one
            case ContainerType.Pile:
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, takeInteraction);
                break;
            }

            return(interactions.ToArray());
        }
コード例 #2
0
        public override IInteraction[] GenerateInteractions(InteractionEvent interactionEvent)
        {
            // The "open" state is changed via the object interaction
            // so we don't need to worry about that here, unless we can store stuff without needing it to open

            List <IInteraction>      interactions     = base.GenerateInteractions(interactionEvent).ToList();
            StoreInteraction         storeInteraction = new StoreInteraction();
            ViewContainerInteraction view             = new ViewContainerInteraction {
                MaxDistance = MaxDistance, icon = viewContainerIcon
            };

            // if its open, we add the store interaction with the view interaction
            if (IsOpen())
            {
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, view);
            }
            // if we can store items without it being open, we generate both interactions
            else if (!OnlyStoreWhenOpen)
            {
                interactions.Add(storeInteraction);
                interactions.Add(view);
            }

            return(interactions.ToArray());
        }
コード例 #3
0
        public override IInteraction[] GenerateInteractionsFromTarget(InteractionEvent interactionEvent)
        {
            // The "open" state is changed via the object interaction
            // so we don't need to worry about that here, unless we can store stuff without needing it to open

            List <IInteraction>      interactions     = base.GenerateInteractionsFromTarget(interactionEvent).ToList();
            StoreInteraction         storeInteraction = new StoreInteraction();
            TakeInteraction          takeInteraction  = new TakeInteraction();
            ViewContainerInteraction view             = new ViewContainerInteraction {
                MaxDistance = MaxDistance, icon = viewContainerIcon
            };

            // Implicit or Normal the Store Interaction will always appear, but View only appears in Normal containers
            if (IsOpen() | !OnlyStoreWhenOpen)
            {
                switch (StorageType)
                {
                case ContainerType.Normal:
                    interactions.Insert(0, storeInteraction);
                    interactions.Insert(1, view);
                    break;

                case ContainerType.Pile:
                    interactions.Insert(0, storeInteraction);
                    interactions.Insert(1, takeInteraction);
                    break;
                }
            }

            return(interactions.ToArray());
        }
コード例 #4
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());
        }
コード例 #5
0
ファイル: DisposalBin.cs プロジェクト: xTheLifex/SS3D
        public override IInteraction[] GenerateInteractions(InteractionEvent interactionEvent)
        {
            List <IInteraction> interactions = new List <IInteraction>();

            StoreInteraction         storeInteraction = new StoreInteraction();
            ViewContainerInteraction view             = new ViewContainerInteraction {
                MaxDistance = range
            };
            DisposeInteraction disposeInteraction = new DisposeInteraction();

            if (!busy)
            {
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, view);
                interactions.Insert(2, disposeInteraction);
            }

            return(interactions.ToArray());
        }
コード例 #6
0
ファイル: StorageContainer.cs プロジェクト: xTheLifex/SS3D
        public override IInteraction[] GenerateInteractions(InteractionEvent interactionEvent)
        {
            List <IInteraction>      interactions     = base.GenerateInteractions(interactionEvent).ToList();
            StoreInteraction         storeInteraction = new StoreInteraction();
            ViewContainerInteraction view             = new ViewContainerInteraction {
                MaxDistance = MaxDistance, icon = viewContainerIcon
            };

            if (IsOpen())
            {
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, view);
            }
            else if (!OnlyStoreWhenOpen)
            {
                interactions.Add(storeInteraction);
                interactions.Add(view);
            }

            return(interactions.ToArray());
        }
コード例 #7
0
        public override IInteraction[] GenerateInteractions(InteractionEvent interactionEvent)
        {
            List <IInteraction> interactions = new List <IInteraction>();

            StoreInteraction storeInteraction = new StoreInteraction();

            // Sets the interaction range
            ViewContainerInteraction view = new ViewContainerInteraction {
                MaxDistance = range
            };
            DisposeInteraction disposeInteraction = new DisposeInteraction();

            // if we arent purging something already, we create the interactions
            if (!busy)
            {
                interactions.Insert(0, storeInteraction);
                interactions.Insert(1, view);
                interactions.Insert(2, disposeInteraction);
            }

            return(interactions.ToArray());
        }