Example #1
0
    /// <summary>
    /// MONOBEHAVIOUR Start
    /// </summary>
    void Start()
    {
        gameCamera = GameObject.Find("Main Camera").GetComponent <Camera>();

        currentEquipment = new TazerController(prefabRepository);
        //currentEquipment = new KnifeController(prefabRepository);
    }
Example #2
0
    public void ChangeStats(EquipmentController _equipment, int _posNeg)
    {
        Debug.Log(_equipment.gameObject);
        healthValue      += _equipment.GetHealthValue() * _posNeg;
        healthMultiplier += _equipment.GetHealthMultiplier() * _posNeg;
        manaValue        += _equipment.GetManaValue() * _posNeg;
        manaMultiplier   += _equipment.GetManaMultiplier() * _posNeg;

        damageValue          += _equipment.GetDamageValue() * _posNeg;
        lightningDamageValue += _equipment.GetLightningDamageValue() * _posNeg;
        fireDamageValue      += _equipment.GetFireDamageValue() * _posNeg;
        iceDamageValue       += _equipment.GetIceDamageValue() * _posNeg;

        armorValue          += _equipment.GetArmorValue() * _posNeg;
        lightningArmorValue += _equipment.GetLightningArmorValue() * _posNeg;
        fireArmorValue      += _equipment.GetFireArmorValue() * _posNeg;
        iceArmorValue       += _equipment.GetIceArmorValue() * _posNeg;

        damageMultiplier          += _equipment.GetDamageMultiplier() * _posNeg;
        lightningDamageMultiplier += _equipment.GetLightningDamageMultiplier() * _posNeg;
        fireDamageMultiplier      += _equipment.GetLightningDamageMultiplier() * _posNeg;
        iceDamageMultiplier       += _equipment.GetIceDamageMultiplier() * _posNeg;

        armorMultiplier          += _equipment.GetArmorMultiplier() * _posNeg;
        lightningArmorMultiplier += _equipment.GetLightningArmorMultiplier() * _posNeg;
        fireArmorMultiplier      += _equipment.GetFireArmorMultiplier() * _posNeg;
        iceArmorMultiplier       += _equipment.GetIceArmorMultiplier() * _posNeg;
    }
        public void CheckIfIdEqualsWithProductName()
        {
            var    controller = new EquipmentController();
            string name       = controller.equipment[2].Name;

            Assert.AreEqual("Komatsu crane", name);
        }
Example #4
0
        public async void TestForCreateEquipmentRequest()
        {
            var options = new DbContextOptionsBuilder <EquipmentContext>()
                          .UseInMemoryDatabase(databaseName: "p3ControllerCreateRequest")
                          .Options;

            using (var context = new EquipmentContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo   r = new Repo(context, new NullLogger <Repo>());
                Logic  l = new Logic(r, new NullLogger <Repo>());
                Mapper m = new Mapper();
                EquipmentController controller = new EquipmentController(l, m);
                var request = new CreateEquipmentRequestDto
                {
                    TeamID  = Guid.NewGuid(),
                    UserID  = "fred",
                    Message = "i need equipment now!",
                    Status  = "Approved",
                    ItemID  = 53,
                };

                var createRequest = await controller.CreateEquipmentRequest(request);

                Assert.Equal("fred", createRequest.Value.UserID);
                Assert.Equal("i need equipment now!", createRequest.Value.Message);
                Assert.Equal(53, createRequest.Value.ItemId);
                Assert.Equal("Approved", createRequest.Value.Status);
            }
        }
Example #5
0
        public async void TestForGetEquipmentItemById()
        {
            var options = new DbContextOptionsBuilder <EquipmentContext>()
                          .UseInMemoryDatabase(databaseName: "p3ControllerGetItemById")
                          .Options;

            using (var context = new EquipmentContext(options))
            {
                context.Database.EnsureDeleted();
                context.Database.EnsureCreated();

                Repo   r = new Repo(context, new NullLogger <Repo>());
                Logic  l = new Logic(r, new NullLogger <Repo>());
                Mapper m = new Mapper();
                EquipmentController controller = new EquipmentController(l, m);
                var item = new EquipmentItem
                {
                    EquipmentID = 43,
                    Description = "golf club"
                };
                r.EquipmentItems.Add(item);
                await r.CommitSave();

                var getItem = await controller.GetEquipmentItemById(item.EquipmentID);

                Assert.Equal("golf club", getItem.Value.Description);
            }
        }
Example #6
0
        public static void RenderArmourFromCharacterConfig(GameObject equipmentObject, Character character)
        {
            EquipmentController controller = equipmentObject.GetComponent <EquipmentController>();
            var        config = JSON.Parse(character.appearanceConfig);
            GameObject equip  = controller.Armour;

            if (equip == null)
            {
                return;
            }
            String itemName = config["ValueList"][8];

            // Debug.Log(itemName);
            Sprite[] allSprites = Resources.LoadAll <Sprite>(itemName);
            foreach (Sprite sprite in allSprites)
            {
                String         part      = string.Format("{0}[Armor]", sprite.ToString().Split(' ')[0]);
                GameObject     subObject = FindChildByRecursion(equip.transform, part).gameObject;
                SpriteRenderer subSprite = subObject.GetComponent <SpriteRenderer>();
                // Debug.Log(sprite);
                // Debug.Log(subObject);
                subSprite.sprite = sprite;
            }
            equip.SetActive(true);
        }
 private bool ValidateInputs()
 {
     if (string.Compare(_equipmentId, "") == 0)
     {
         MessageBox.Show("Polje za unos šifre ne može biti prazno!", "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (EquipmentController.getInstance().findEquipmentById(_equipmentId) != null)
     {
         MessageBox.Show("U sistemu postoji oprema sa ovom šifrom!", "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (string.Compare(nameTextBox.Text, "") == 0)
     {
         MessageBox.Show("Polje za unos naziva ne može biti prazno!", "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (typeOfEquipmentComboBox.SelectedItem == null)
     {
         MessageBox.Show("Niste odabrali tip opreme!", "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     else if (_equipmentQuantity == 0)
     {
         MessageBox.Show("Pogrešan unos količine!", "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
     return(true);
 }
    void Start()
    {
        EquipmentController = GetComponent <EquipmentController>();
        PlayerPickUp        = GetComponent <PlayerPickUpHandler>();

        _items = new Dictionary <int, List <GridItem> >();
    }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (name.Text == "" || quantity.Text == "")
            {
                MessageBox.Show("Please fill Name and Quantity fields.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            Regex regex1 = new Regex(@"^([0-9]+)$");


            if (!regex1.IsMatch(quantity.Text))
            {
                MessageBox.Show("Please, insert a number for quantity!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }


            Equipment equ = new Equipment(eq.id, name.Text, int.Parse(quantity.Text), eq.room);

            EquipmentController EquipmentContr = new EquipmentController();

            EquipmentContr.Update(equ);


            GridMain.Children.Clear();
            UserControl usc = new WpfApp2.ListOfEquipment();

            GridMain.Children.Add(usc);
        }
 private void SprzetyAddModBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SprzetyAddModBtn.Content.ToString() == "Dodaj")
     {
         try
         {
             using (var context = new SqliteContext())
             {
                 if (context.Equipments.Any(x => x.Name == SprzetyAddNazwa.Text))
                 {
                     var equipment = context.Equipments.FirstOrDefault(x => x.Name == SprzetyAddNazwa.Text);
                     if (equipment != null)
                     {
                         EquipmentController.Edit(new Equipment()
                         {
                             Id    = equipment.Id,
                             Name  = equipment.Name,
                             Count = int.Parse(SprzetyAddIlosc.Text) + equipment.Count
                         });
                     }
                 }
                 else
                 {
                     EquipmentController.Add(new Equipment()
                     {
                         Id    = int.TryParse(SprzetyAddId.Text, out int temp) ? temp : 1,
                         Name  = SprzetyAddNazwa.Text,
                         Count = int.TryParse(SprzetyAddIlosc.Text, out int temp1) ? temp1 : -1
                     });
                 }
             }
Example #11
0
 public void UpdateSlot()
 {
     //Debug.Log(E.Name);
     if (PC.GetInventoryItem(Slot) == E)
     {
         return;
     }
     else
     {
         E = PC.GetInventoryItem(Slot);
         if (E != null)
         {
             if (EquipmentIcon != null)
             {
                 DestroyObject(EquipmentIcon);
             }
             EquipmentIcon = EquipmentController.ObtainInventoryIcon(E, transform);
         }
         else
         {
             DestroyObject(EquipmentIcon);
             EquipmentIcon = null;
         }
     }
 }
 private void ReduceRoomEquipmentQuantity()
 {
     foreach (DictionaryEntry de in reducedEquipment)
     {
         EquipmentController.getInstance().findEquipmentById(de.Key.ToString()).ReduceQuantity((int)de.Value);
     }
 }
Example #13
0
    void Update()
    {
        for (int i = 0; i < Math.Min(debugItems.Length, 10); i++)
        {
            if (Input.GetKeyDown(KeyCode.Alpha0 + i))
            {
                Debug.Log("Pressed " + i);

                if (debugItems[i] == null)
                {
                    Debug.Log("Item is null");
                }
                else if (debugItems[i].IsEquipable())
                {
                    Debug.Log("Using " + debugItems[i].Name);
                    EquipmentController.EquipItem(debugItems[i]);
                }
                else
                {
                    Debug.Log(debugItems[i].Name + " is not usable");
                }
            }
            else if (Input.GetKeyDown(KeyCode.P))
            {
                Debug.Log("Purged save data");
                PlayerPrefs.DeleteAll();
                SaveSystemController saveSystem = FindObjectOfType <SaveSystemController>();
                saveSystem.enabled = false;
            }
        }
    }
Example #14
0
 public override void SetEquipment(Camera camera, Transform player = null, EquipmentController equipmentController = null)
 {
     fpsCam        = camera;
     targetMagnets = new List <Magnet>();
     targets       = 0;
     targetMagnets.Clear();
 }
Example #15
0
        /// <summary>
        /// Setup the test
        /// </summary>
        public EquipmentUnitTest()
        {
            DbContextOptions <DbAppContext> options      = new DbContextOptions <DbAppContext>();
            Mock <DbAppContext>             dbAppContext = new Mock <DbAppContext>(null, options);
            EquipmentService _service = new EquipmentService(null, dbAppContext.Object);

            _Equipment = new EquipmentController(_service);
        }
Example #16
0
        public void GetById()
        {
            EquipmentController controller = new EquipmentController();

            Equipment result = controller.Get(5);

            Assert.AreEqual(Equipment.FindAll()[4], result);
        }
Example #17
0
        public void Get()
        {
            EquipmentController controller = new EquipmentController();

            Equipment[] result = controller.Get();

            CollectionAssert.AreEqual(Equipment.FindAll(), result);
        }
Example #18
0
 private AddEquipmentToRoomWindow(Hashtable currentRoomEquipment, string equipmentType, string window)
 {
     InitializeComponent();
     equipmentListBox.ItemsSource = null;
     equipmentListBox.ItemsSource = EquipmentController.getInstance().MakeEquipmentForRoom(equipmentType, currentRoomEquipment);
     this.window           = window;
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
 }
        public void Get_existent_equipment_by_valid_room_number()
        {
            EquipmentController equipmentController = SetupEquipmentController();

            var result = equipmentController.GetEquipmentByRoomNumber(56);

            Assert.True(result is OkObjectResult);
        }
Example #20
0
    public virtual void Equip(Equipment E)
    {
        PlayerData.Equipments[(int)E.EquipType] = E;
        GameObject equipPrefab = EquipmentController.ObtainPrefab(E, transform);

        EquipPrefabs[(int)E.EquipType] = equipPrefab;
        UpdateStats();
        //CacheManager.SaveCurrentPlayerInfo();
    }
    private void Awake()
    {
        if (instance != null)
        {
            return;
        }

        instance = this;
    }
Example #22
0
    // Use this for initialization
    void Start()
    {
        GameObject p = GameObject.FindGameObjectWithTag("Player");
        mCtrl = p.GetComponent<MovementController>();
        aCtrl = p.GetComponent<AttackController>();
        eCtrl = p.GetComponent<EquipmentController>();

        game = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameController>();
    }
 private void Awake()
 {
     _characterController  = GetComponent <MainPlatformerController>();
     _itemFinderController = GetComponent <ItemFinderController>();
     _inventoryComponent   = GetComponent <InventoryComponent>();
     _questLogComponent    = GetComponent <QuestLogComponent>();
     _equipmentController  = GetComponent <EquipmentController>();
     _uiController         = GetComponent <UiController>();
 }
Example #24
0
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogWarning("More than one instance of Equipment Controller Found!");
         return;
     }
     instance = this;
 }
        public void Get_existent_equipment_by_invalid_room_number()
        {
            EquipmentController equipmentController = SetupEquipmentController();

            EquipmentInRooms invalidEquipmentInRoom = _createEquipmentInRoom.CreateInvalidTestObject();
            IActionResult    result = equipmentController.GetEquipmentByRoomNumber(invalidEquipmentInRoom.RoomNumber);

            Assert.True(result is NotFoundObjectResult);
        }
Example #26
0
    public void Equip(Equipment E)
    {
        PlayerData.Equipments[E.Type] = E;
        GameObject equipPrefab = EquipmentController.ObtainPrefab(E, transform);

        EquipPrefabs[E.Type] = equipPrefab;
        UpdateStats();
        SLM.SaveCurrentPlayerInfo();
    }
 void Awake()
 {
     if (_instance != null)
     {
         Debug.LogError("More than one instance of a singleton detected");
         return;
     }
     _instance = this;
 }
 private void Awake()
 {
     weaponPlace   = GetComponent <Transform>();
     equipment     = transform.parent.GetComponent <EquipmentController>();
     speakerShot   = transform.parent.GetComponent <AudioSource>();
     speakerReload = GetComponent <AudioSource>();
     spawn         = weaponPlace.Find("BulletSpawn");
     mainCamera    = Camera.main;
 }
        private EquipmentController SetupEquipmentController()
        {
            EquipmentService         _equipmentService        = new EquipmentService(_stubRepository.CreateEquipmentStubRepository(), _stubRepository.CreateEquipmentInRoomStubRepository(), _stubRepository.CreateExaminationStubRepository());
            EquipmentTypeService     equipmentTypeService     = new EquipmentTypeService(_stubRepository.CreateEquipmentTypeStubRepository());
            EquipmentInRoomsService  equipmentInRoomsService  = new EquipmentInRoomsService(_stubRepository.CreateEquipmentInRoomStubRepository(), _equipmentService);
            EquipmentTransferService equipmentTransferService = new EquipmentTransferService(_stubRepository.CreateEquipmentTransferStubRepository());
            EquipmentController      _equipmentController     = new EquipmentController(_equipmentService, equipmentTypeService, equipmentInRoomsService, equipmentTransferService);

            return(_equipmentController);
        }
Example #30
0
    public void SetItems(GameObject character)
    {
        EquipmentController ec = character.GetComponent <EquipmentController>();

        equippedHead.SetItem(ec.equippedHead);
        equippedChest.SetItem(ec.equippedChest);
        equippedArms.SetItem(ec.equippedArms);
        equippedWaist.SetItem(ec.equippedWaist);
        equippedLegs.SetItem(ec.equippedLegs);
    }
        public async Task EquipmentController_Index_Test()
        {
            // Arrange
            EquipmentController controller = IoCFactory.Instance.CurrentContainer.Resolve <EquipmentController>();;

            // Act
            ViewResult result = await controller.Index() as ViewResult;

            // Assert
            Assert.IsNotNull(result);
        }
Example #32
0
    void Awake()
    {
        songController = (SongController)FindObjectOfType (typeof(SongController));
        concertController = (ConcertController)FindObjectOfType (typeof(ConcertController));
        tourController = (TourController)FindObjectOfType(typeof(TourController));
        merchController = (MerchController)FindObjectOfType(typeof(MerchController));
        equipmentController = (EquipmentController)FindObjectOfType(typeof(EquipmentController));
        hudUI = (HudUI)FindObjectOfType(typeof(HudUI));

        currencyState = GameState.instance.Currency;
    }
 public void MyTestInitialize()
 {
     // Set up the SubscriberController
     EquipmentControllerForTests = DependencyResolver.Current.GetService<EquipmentController>();
 }