Exemple #1
0
 public AddToInventoryService(GameObject gameObject, PickupableItemConfig config, AddToInventoryEventRepository addToInventoryEventRepository, PlayerInventory inventory)
 {
     this.gameObject = gameObject;
     this.config     = config ?? throw new ArgumentNullException(nameof(config));
     this.addToInventoryEventRepository = addToInventoryEventRepository ?? throw new ArgumentNullException(nameof(addToInventoryEventRepository));
     this.inventory = inventory ?? throw new ArgumentNullException(nameof(inventory));
 }
Exemple #2
0
        public PickupableItemController(GameObject gameObject, IServiceProvider serviceProvider, PickupableItemConfig config) : base(gameObject, serviceProvider)
        {
            this.config = config ?? throw new ArgumentNullException(nameof(config));
            var marker         = gameObject.GetComponent <PickupableItemMarker>();
            var dialogueParser = ServiceProvider.GetService <DialogueParser>();

            dialogue = dialogueParser.FromFile(marker.DialogueFile);
        }
        private void CreateInteractiveObjectControllers()
        {
            var interactiveObjects = FindObjectsOfType(typeof(PickupableItemMarker)) as PickupableItemMarker[];

            if (interactiveObjects == null)
            {
                return;
            }

            foreach (var interactiveObject in interactiveObjects)
            {
                var config     = PickupableItemConfig.FromMarker(interactiveObject);
                var controller = new PickupableItemController(interactiveObject.gameObject, serviceProvider, config);
                controllers.Add(controller);
            }
        }