Exemplo n.º 1
0
        public override IAction Interact(Entity activeActor, Entity pasiveActor)
        {
            ItemInteractionController visualizer = GetVisualizersList().Find(x => x.ReplaceItem.GetComponent <Entity>() == pasiveActor);

            GetVisualizersList().Remove(visualizer);
            PickItemAction result = new PickItemAction(activeActor, pasiveActor, visualizer);

            return(result);
        }
Exemplo n.º 2
0
        public override void EntityExitsRange(Entity activeActor, Entity pasiveActor)
        {
            ItemInteractionController visualizer = GetVisualizersList().Find(x => x.ReplaceItem.GetComponent <Entity>() == pasiveActor);

            if (visualizer != null)
            {
                GetVisualizersList().Remove(visualizer);
                visualizer.Dispose();
            }
        }
Exemplo n.º 3
0
        public override void EntityEntersRange(Entity activeActor, Entity pasiveActor)
        {
            Inventory inventory = activeActor.GetComponent <Inventory>();
            Item      item      = pasiveActor.GetComponent <Item>();

            if (inventory != null && item != null)
            {
                Transform worldTransform             = GameObject.FindGameObjectWithTag("World").transform;
                Vector3   spawnPosition              = Locator.Get <GameManager>().Renderer.SnappedTileMapToWorldPosition(pasiveActor.CellTransform.Position);
                ItemInteractionController visualizer = visualizerPrefab.Spawn(worldTransform, spawnPosition);
                visualizer.Initialize(activeActor, item);
                GetVisualizersList().Add(visualizer);
            }
        }