void SetUpAbilities() { AbilityBehaviour[] abiliySlots = new AbilityBehaviour[3]; abiliySlots[0] = GameObject.Find("Ability 0").GetComponent <AbilityBehaviour>(); abiliySlots[1] = GameObject.Find("Ability 1").GetComponent <AbilityBehaviour>(); abiliySlots[2] = GameObject.Find("Ability 2").GetComponent <AbilityBehaviour>(); string abilityName; for (int a = 0; a < abiliySlots.Length; a++) { abilityName = PlayerStatMeta.GetAbilityName(a); Debug.Log("Setting an ability to be: " + abilityName); switch (abilityName.ToUpper()) { case "DEFEND": { abiliySlots[a].SetAbilityType(AbilityType.defend); abiliySlots[a].SetCoolDownTime(PlayerStatMeta.GetAbilityCoolDown(a)); abiliySlots[a].SetPotency(1); } break; case "DODGE": { abiliySlots[a].SetAbilityType(AbilityType.dodge); abiliySlots[a].SetCoolDownTime(PlayerStatMeta.GetAbilityCoolDown(a)); abiliySlots[a].SetPotency(1); } break; case "STUN": { abiliySlots[a].SetAbilityType(AbilityType.stun); abiliySlots[a].SetCoolDownTime(PlayerStatMeta.GetAbilityCoolDown(a)); abiliySlots[a].SetPotency(1); } break; } } }
public Ability(BasePlayer thisPlayer, int thisID) { ID = thisID; Behaviour = new AbilityBehaviour(this); myPlayer = thisPlayer; assignValues(); }
public void Action(Ability ability) { this.ability = ability; spawned = true; abilityBehaviour = FindAbility.GetAbilityBehaviour("Protection", ability); StartCoroutine(DestroyAfterSeconds(ability.AbilityDuration)); }
public static void ConfigAbility(AbilityConfig config) { AbilityName abilityName = (AbilityName)System.Enum.Parse(typeof(AbilityName), StringOperation.ToFirstUpper(config.abilityName)); if (!abilities.ContainsKey(abilityName)) { Debug.Log("ability " + abilityName + " does not exist"); return; } AbilityBehaviour ability = abilities[abilityName]; ability.abilityEnabled = config.enabled; ability.isChargeMode = config.isChargeMode; ability.chargeCount = config.chargeCount; }
public void StartGame(LevelInfo levelInfo) { PageNavigationManager.GetInstance().ChangePage("game"); onInitLevel.Invoke(); //init tileManager and wordChecker wordChecker.showHints = levelInfo.showHints; List <string> wordList = new List <string>(levelInfo.words); wordChecker.SetWordList(wordList); if (levelInfo.weights.Length == 0) { tileManager.AutoAdjustCharacterWeight(wordList); } else { tileManager.characterWeights = (new List <TileManager.CharacterWeight>(levelInfo.weights)); } tileManager.rowCount = levelInfo.rowCount; tileManager.colCount = levelInfo.colCount; tileManager.GenerateTiles(levelInfo.tileSetup); //level required words requiredWords.Clear(); if (levelInfo.requiredWords.Length == 0) { hasWordTarget = false; } else { hasWordTarget = true; for (int i = 0; i < levelInfo.requiredWords.Length; i++) { RequiredWord rw = levelInfo.requiredWords[i]; requiredWords[rw.word.ToUpper()] = rw.count; } } //Filtered words for quiz level Dictionary <string, string> filteredWords = new Dictionary <string, string>(); for (int i = 0; i < levelInfo.filteredWords.Length; i++) { filteredWords[levelInfo.filteredWords[i].originalWord.ToUpper()] = levelInfo.filteredWords[i].filteredWord; } //UI related if (topText != null) { remainingWordlist.ClearList(); topText.text = levelInfo.topText; if (levelInfo.topText == "") { remainingWordlist.SetWordList(levelInfo.requiredWords, filteredWords); } } retryButton.SetActive(levelInfo.canRetry); detailButton.SetActive(levelInfo.detailPanel.visible); if (levelInfo.detailPanel.visible) { detailPanel.Show(true); detailPanel.title = levelInfo.detailPanel.title; detailPanel.duration = levelInfo.duration; detailPanel.image = Resources.Load <Sprite>(levelInfo.detailPanel.imagePath); if (detailPanel.image == null) { detailPanel.SetWordList(new List <RequiredWord>(levelInfo.requiredWords), filteredWords); } else { detailPanel.ClearWordList(); } } else { detailPanel.Hide(false); } //Timer related timer.StopTimer(); timer.paused = false; timer.duration = levelInfo.duration; pauseButton.SetActive(levelInfo.duration >= 0); //abilities AbilityBehaviour.ResetAllAbilities(); for (int i = 0; i < levelInfo.abilities.Length; i++) { AbilityBehaviour.ConfigAbility(levelInfo.abilities[i]); } //link linkController.shouldGenerateNewTile = levelInfo.shouldGenerateNewTile; }
public void AddComponent(GameObject gameObjectToAttachTo) { behaviour = GetBehaviourComponent(gameObjectToAttachTo); behaviour.SetConfig(this); }
public void ChangeBehaviour(AbilityBehaviour behaviour) { this.behaviour = behaviour; CurrentAmmo = behaviour.AmmoCapacity; }