void Start()
 {
     abCont = gameObject.GetComponent <AbilitiesController>();
     pCont  = gameObject.GetComponent <PlayerController>();
     lastReceivedAbility = null;
     mode = GUIMode.GAME;
 }
    public void Setup(Ability abilityProperties)
    {
        global_abilityProperties = abilityProperties;
        AMC = GameObject.Find("AbilitiesMenu").GetComponent<AbilityMenuController>();
        AC = GameObject.Find("Player").GetComponentInChildren<AbilitiesController>();
        unslotAbility = AMC.GetComponentInChildren<PlayerAbilityUIMenu>();

        abilityName = transform.Find("AbilityName").GetComponent<TextMeshProUGUI>().text = abilityProperties.ReturnBasicStats().Item1.ToUpper();
        transform.Find("Preview").Find("Icon").GetComponent<Image>().sprite = abilityProperties.ReturnBasicStats().Item2;
        transform.Find("AbilityLevel").Find("Level").GetComponent<TextMeshProUGUI>().text = abilityProperties.ReturnBasicStats().Item3.ToString();
        transform.Find("ExpBar").Find("Progress").GetComponent<Image>().fillAmount = abilityProperties.ReturnBasicStats().Item4;

        if (!abilityProperties.ReturnAccessible())
        {
            foreach(Transform child in transform)
            {
                child.gameObject.SetActive(false);
            }
            transform.Find("Unknown").gameObject.SetActive(true);
        }
        else if (test_if_used())
        {
            transform.Find("Sub Menu").gameObject.SetActive(false);
            transform.Find("Sub Menu").gameObject.name = "Sub Menu Equip";
            transform.Find("Sub Menu Unequip").gameObject.SetActive(true);
            transform.Find("Sub Menu Unequip").gameObject.name = "Sub Menu";
            gameObject.SetActive(false);
            gameObject.SetActive(true); 
        }
    }
Exemplo n.º 3
0
        public async Task Abilities()
        {
            var controller = new AbilitiesController();
            var list       = await controller.Get();

            Assert.IsTrue(list.Count > 0);
        }
Exemplo n.º 4
0
        private IAbilitiesController ConfigureAbilityController(
            Transform placeForUi,
            IAbilityActivator abilityActivator, ProfilePlayer profilePlayer)
        {
            var abilityItemsConfigCollection
                = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath
            {
                PathResource = "DataSource/Ability/AbilityItemConfigDataSource"
            });
            var abilityRepository
                = new AbilityRepository(abilityItemsConfigCollection);
            var abilityCollectionViewPath
                = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
                };
            var abilityCollectionView
                = ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi,
                                                                                  false);

            AddGameObjects(abilityCollectionView.gameObject);

            var abilitiesController = new AbilitiesController(abilityRepository, profilePlayer.InventoryModel,
                                                              abilityCollectionView, abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Exemplo n.º 5
0
 // Use this for initialization
 void Awake()
 {
     AbilitiesCtrl = GetComponent <AbilitiesController>();
     if (gameObject.tag == "Player")
     {
         HpHelper = GetComponent <HealHelper>();
         ExpList  = new int[11] {
             0, 100, 250, 450, 800, 1250, 1700, 2300, 2900, 3500, 9999999
         };
     }
     if (gameObject.tag == "Player")
     {
         if (Connection.IsServer)
         {
             PlayerInfo.RequestHP();
         }
         else
         {
             if (PlayerPrefs.HasKey("PlayerHp"))
             {
                 Hp = PlayerPrefs.GetInt("PlayerHp");
             }
             else
             {
                 Hp = 100;
             }
         }
     }
 }
Exemplo n.º 6
0
 private void Awake()
 {
     if (Instance != null)
     {
         return;
     }
     Instance = this;
 }
Exemplo n.º 7
0
    private void Start()
    {
        abilitiesController = AbilitiesController.Instance;
        audioManager        = AudioManager.Instance;

        //reset vignette value
        vignette.intensity.value = 0;
    }
 private void Start()
 {
     Inventory      = GameObject.Find("Player").GetComponentInChildren <Inventory>();
     Storage        = GameObject.Find("WeaponStorage").transform;
     pAU            = GameObject.Find("Player").GetComponentInChildren <PlayerAnimationUpdater>();
     AC             = FindObjectOfType <AbilitiesController>();
     weaponDisplay  = GameObject.Find("WeaponDisplay").transform;
     lastUsedWeapon = false;
 }
 void Start()
 {
     abCont                  = GameObject.Find("Player").GetComponentInChildren <AbilitiesController>();
     Inventory               = GameObject.Find("Player").GetComponentInChildren <Inventory>();
     Quickslot_item          = GameObject.Find("Quickslot_item").transform;
     ItemImage               = Quickslot_item.Find("Image").GetComponent <Image>();
     cooldownFill            = Quickslot_item.Find("CooldownDarken").GetComponent <Image>();
     cooldownFill.fillAmount = 0;
 }
        public async Task Test3GetOne()
        {
            AbilitiesController controller = new AbilitiesController(_context, null);
            IActionResult       result     = await controller.Get(this.id);

            OkObjectResult ok = result as OkObjectResult;

            Assert.NotNull(ok);
            Assert.Equal(200, ok.StatusCode);
        }
        public void Setup()
        {
            _casted      = false;
            _mockFactory = Substitute.For <IAbilityDataHub>();
            _controller  = new AbilitiesController <IAbility <IAbilityDataHub>, IAbilityDataHub>(3, _mockFactory);

            PrepareMockAbility(_mockAbility1, 0);
            PrepareMockAbility(_mockAbility2, 1);
            PrepareMockAbility(_mockAbility3, 2);
        }
    // Start is called before the first frame update
    void Awake()
    {
        AC  = GameObject.Find("Player").GetComponentInChildren <AbilitiesController>();
        AMC = GetComponentInParent <AbilityMenuController>();

        AbilitySlots[0] = transform.Find("Ability0");
        AbilitySlots[1] = transform.Find("Ability1");
        AbilitySlots[2] = transform.Find("Ability2");
        AbilitySlots[3] = transform.Find("Ability3");
    }
Exemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     // Core functionality
     playerMovement       = GetComponent <PlayerMovement>();
     weaponController     = GetComponentInChildren <WeaponController>();
     animationUpdater     = GetComponentInChildren <PlayerAnimationUpdater>();
     abilitiesController  = GetComponentInChildren <AbilitiesController>();
     consumableController = GetComponentInChildren <ConsumableController>();
     UIControl            = GameObject.Find("UI").GetComponent <UIController>();
     rollingCollider      = GameObject.Find("RollingCollider").GetComponent <Collider>();
 }
        public void Test1GetAll()
        {
            AbilitiesController    controller = new AbilitiesController(_context, null);
            CollectionRequestModel collection = new CollectionRequestModel();
            IActionResult          a          = controller.Get(collection);

            OkObjectResult ok = a as OkObjectResult;

            Assert.NotNull(ok);
            Assert.Equal(200, ok.StatusCode);
        }
Exemplo n.º 15
0
    private void Start()
    {
        player = GameObject.Find("Player").transform;
        inv    = player.GetComponentInChildren <Inventory>();
        AC     = player.GetComponentInChildren <AbilitiesController>();
        QH     = FindObjectOfType <QuestsHolder>();

        if (!Initialize_Default)
        {
            StartCoroutine("Load");
        }
    }
        public async Task Should_Return_400_Status_Code_With_Invalid_ViewModel()
        {
            // Arrange
            var data = new AbilityViewModel();

            var abilitiesController = new AbilitiesController(abilityServices.Object);

            // Act
            var response = await abilitiesController.Create(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <BadRequestObjectResult>(response.Result);
        }
        public async Task Test4Put()
        {
            AbilityMutateModel mutateModel = new AbilityMutateModel
            {
                Name        = "TestMetaUpdated",
                Description = "This is a meta created by the unit test"
            };

            AbilitiesController controller = new AbilitiesController(_context, null);
            IActionResult       result     = await controller.Put(this.id, mutateModel);

            NoContentResult ok = result as NoContentResult;

            Assert.NotNull(ok);
            Assert.Equal(204, ok.StatusCode);
        }
        public async Task Test2Create()
        {
            Ability meta = new Ability
            {
                Id          = this.id,
                Name        = "TestAbility",
                Description = "This is a ability created by the unit test"
            };

            AbilitiesController controller = new AbilitiesController(_context, null);
            IActionResult       result     = await controller.Post(meta);

            OkObjectResult ok = result as OkObjectResult;

            Assert.NotNull(ok);
            Assert.Equal(200, ok.StatusCode);
        }
        public async Task Should_Return_201_Status_Code_With_Valid_ViewModel()
        {
            // var actionValue = Assert.IsAssignableFrom<IEnumerable<CustomerAddressViewModel>>(actionResult.Value);
            // Arrange
            var data = BogusViewModel.AbilityViewModelFaker();

            abilityServices.Setup(x => x.CreateAbility(data)).ReturnsAsync(data);

            var abilitiesController = new AbilitiesController(abilityServices.Object);

            // Act
            var response = await abilitiesController.Create(data);

            // Assert
            Assert.NotNull(response);
            Assert.IsType <CreatedResult>(response.Result);
        }
Exemplo n.º 20
0
        public void Intitialize()
        {
            _pokedexAPILogicMock = new Mock <IPokedexAPILogic>();
            _pokedexAPILogicMock.Setup(plm => plm.GetAllAbilities()).ReturnsAsync(It.IsAny <List <GenericLookupResult> >());
            _pokedexAPILogicMock.Setup(plm => plm.GetAbilityById(1)).ReturnsAsync(new GenericLookupResult {
                Id = 1
            });

            _loggerMock = new Mock <ILoggerAdapter <AbilitiesController> >();

            _paginationHelperMock = new Mock <IPaginationHelper>();

            _paginationHelperMock.Setup(phm => phm.GetPagedResults(It.IsAny <IEnumerable <GenericLookupResult> >(),
                                                                   It.IsAny <int>(), It.IsAny <int>())).Returns(new PagedResult <GenericLookupResult>());

            _abilitiesController = new AbilitiesController(_pokedexAPILogicMock.Object,
                                                           _paginationHelperMock.Object, _loggerMock.Object);
        }
Exemplo n.º 21
0
    //###################################################################################################
    //Health Section-------------------------------------------------------------------------------------
    //###################################################################################################
    public void Awake()
    {
        ResetBuffIcons();
        occupiedSpaces = new List <Vector2>();

        if (size == 1)
        {
            occupiedSpaces.Add(new Vector2(0, 0));
        }
        else if (size == 2)
        {
            occupiedSpaces.Add(new Vector2(0.5f, 0.5f));
            occupiedSpaces.Add(new Vector2(-0.5f, -0.5f));
            occupiedSpaces.Add(new Vector2(-0.5f, 0.5f));
            occupiedSpaces.Add(new Vector2(0.5f, -0.5f));
        }

        abilitiesController = GetComponent <AbilitiesController>();
    }
Exemplo n.º 22
0
    private void Awake()
    {
        Assert.IsTrue(cooldown >= STARTUP_DECLARATIONS.AbilityAnimationCastTime[(int)abilityAnimation]);

        Player              = GameObject.Find("Player").transform;
        eventQueue          = GameObject.Find("EventDisplay").GetComponent <EventQueue>();
        activePerks         = Player.GetComponentInChildren <ActivePerks>();
        cursorLogic         = GameObject.Find("Master Object").GetComponent <CursorLogic>();
        playerMovement      = Player.GetComponent <PlayerMovement>();
        energy              = Player.GetComponent <Energy>();
        animationUpdater    = Player.GetComponentInChildren <PlayerAnimationUpdater>();
        weaponController    = Player.GetComponentInChildren <WeaponController>();
        abilitiesController = Player.GetComponentInChildren <AbilitiesController>();
        PlayerProjectiles   = GameObject.Find("PlayerProjectiles").transform;
        playerStats         = Player.GetComponent <PlayerStats>();
        cooldown_remaining  = 0f;

        //
        current_level = 1;
        current_xp    = 0;
        //
    }
Exemplo n.º 23
0
        private IAbilitiesController ConfigureAbilityController(Transform placeForUi, IAbilityActivator abilityActivator, IReadOnlyList <IItem> items)
        {
            var abilityItemsConfigCollection = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath {
                PathResource = "DataSource/Abilities/AbilityItemConfigDataSource"
            });
            var abilityRepository         = new AbilityRepository(abilityItemsConfigCollection);
            var abilityCollectionViewPath = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
            };
            var abilityCollectionView = ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi, false);

            AddGameObjects(abilityCollectionView.gameObject);

            // загрузить в модель экипированные предметы можно любым способом
            var inventoryModel = new InventoryModel();

            inventoryModel.EquipItems(items);

            var abilitiesController = new AbilitiesController(abilityRepository, inventoryModel, abilityCollectionView, abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Exemplo n.º 24
0
        private BaseController ConfigureAbilityController(Transform placeForUi, IAbilityActivator abilityActivator)
        {
            var abilityItemsConfigCollection
                = ContentDataSourceLoader.LoadAbilityItemConfigs(new ResourcePath {
                PathResource = "DataSource/Ability/AbilityItemConfigDataSource"
            });

            var abilityRepository
                = new AbilityRepository(abilityItemsConfigCollection);

            var abilityCollectionViewPath
                = new ResourcePath {
                PathResource = $"Prefabs/{nameof(AbilityCollectionView)}"
                };
            var abilityCollectionView =
                ResourceLoader.LoadAndInstantiateObject <AbilityCollectionView>(abilityCollectionViewPath, placeForUi, false);

            AddGameObjects(abilityCollectionView.gameObject);

            var abilityItemsRepository
                = new ItemsRepository(abilityItemsConfigCollection.Select(value => value.ItemConfig).ToList());

            var inventoryModel = new InventoryModel();

            foreach (var item in abilityItemsRepository.Collection.Values)
            {
                inventoryModel.EquipItem(item);
            }

            var abilitiesController = new AbilitiesController(abilityRepository, inventoryModel, abilityCollectionView,
                                                              abilityActivator);

            AddController(abilitiesController);

            return(abilitiesController);
        }
Exemplo n.º 25
0
 private void Start()
 {
     abilitiesController = AbilitiesController.Instance;
     playerCharacter     = FindObjectOfType <PlayerCharacter> ();
 }
Exemplo n.º 26
0
 private void Start()
 {
     abilitiesController = AbilitiesController.Instance;
 }
    public void SetDescription(Sprite character, HealthController healthController, List <CardController> cards, Dictionary <Buff, int> buffs, AbilitiesController abilitiesController)
    {
        int currentHealth = healthController.GetVit();
        int maxHealth     = healthController.GetMaxVit();
        int attack        = healthController.GetAttack();
        int shield        = healthController.GetShield();

        numOfCards = cards.Count;

        //Stats section
        characterImage.sprite = character;
        healthText.text       = "Health: {c}/{m}".Replace("{c}", currentHealth.ToString()).Replace("{m}", maxHealth.ToString());
        armorText.text        = "Attack: {a}".Replace("{a}", attack.ToString());
        shieldText.text       = "Armor: {s}".Replace("{s}", shield.ToString());

        if (cards.Count == 0)
        {
            attackText.enabled = false;
        }
        else
        {
            attackText.enabled = true;
        }

        //Attack cards section
        for (int i = 0; i < attackCards.Count; i++)
        {
            if (i < cards.Count)
            {
                attackCards[i].GetComponent <CardController>().SetCaster(healthController.gameObject);
                attackCards[i].SetCard(cards[i]);
                attackCards[i].Show();
                attackCards[i].GetComponent <LineRenderer>().enabled = false;
            }
            else
            {
                attackCards[i].Hide();
            }
        }

        //Buff section
        List <Buff> buffList     = new List <Buff>();
        List <int>  durationList = new List <int>();

        buffList.AddRange(buffs.OrderBy(x => x.Value).ToDictionary(k => k.Key, v => v.Value).Keys);
        durationList.AddRange(buffs.OrderBy(x => x.Value).ToDictionary(k => k.Key, v => v.Value).Values);

        for (int i = 0; i < buffDescriptions.Count; i++)
        {
            if (i < buffs.Count)
            {
                buffDescriptions[i].SetBuff(buffList[i], durationList[i]);
                buffDescriptions[i].Show();
            }
            else
            {
                buffDescriptions[i].Hide();
            }
        }

        //Abilities section
        List <string> abilityStrings = abilitiesController.GetAbilityStrings();

        for (int i = 0; i < abilityTexts.Count; i++)
        {
            if (i < abilityStrings.Count)
            {
                abilityTexts[i].text = abilityStrings[i];
            }
            else
            {
                abilityTexts[i].text = "";
            }
        }
    }
Exemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     AbilitiesCtrl = GetComponent <AbilitiesController>();
 }
Exemplo n.º 29
0
 private void Awake()
 {
     hazard              = transform.parent.GetComponent <HazardSettings> ();
     playerCharacter     = FindObjectOfType <PlayerCharacter> ();
     abilitiesController = AbilitiesController.Instance;
 }
Exemplo n.º 30
0
 private void Start()
 {
     hazard              = GetComponent <HazardSettings> ();
     playerCharacter     = FindObjectOfType <PlayerCharacter> ();
     abilitiesController = AbilitiesController.Instance;
 }
 void Start()
 {
     abCont = gameObject.GetComponent<AbilitiesController>();
     pCont = gameObject.GetComponent<PlayerController>();
     lastReceivedAbility = null;
     mode = GUIMode.GAME;
 }