public void ActivateSpecialActive(Item item, GameObject enemy) { SpecialItems special = Database.instance.ItemSpecialItem(item); for (int i = 0; i < special.specialProps.Length; i++) { switch (special.specialProps[i]) { case SpecialProp.stun: StunEnemy(special, enemy); break; case SpecialProp.bleed: BleedEnemy(special, enemy); break; case SpecialProp.cleave: CleaveEnemy(enemy); break; default: Debug.LogWarning(item.itemName + " does not have an active special"); break; } } }
/// <summary> /// Initializes control due to settings /// </summary> private void SetupControl(Type enumType) { chkEnum.Visible = false; drpEnum.Visible = false; radEnum.Visible = false; var ctrl = CurrentSelector; ctrl.Visible = true; ctrl.Items.Clear(); // Fill special items SpecialItems.FillItems(ctrl.Items); // Fill the control with enumeration values var excludedValues = !string.IsNullOrEmpty(ExcludedValues) ? ExcludedValues.Split(';').ToList() : null; var selectedCategories = !string.IsNullOrEmpty(SelectedCategories) ? SelectedCategories.Split(';').ToList() : null; ControlsHelper.FillListControlWithEnum(ctrl, enumType, null, Sort, UseStringRepresentation, excludedValues, selectedCategories); if (!String.IsNullOrEmpty(CssClass)) { ctrl.AddCssClass(CssClass); } }
IEnumerator UnStunEnemy(SpecialItems special, EnemyController enemy) { enemy.stunned = true; yield return(new WaitForSeconds(special.specialDuration)); enemy.stunned = false; }
// Activates in drop of RobotFunctions public void ActivateSpecialPassive(Item item) { print("special Check"); SpecialItems special = Database.instance.ItemSpecialItem(item); for (int i = 0; i < special.specialProps.Length; i++) { switch (special.specialProps[i]) { case SpecialProp.shield: CreateShield(item, special); break; case SpecialProp.heal: StartCoroutine(HealOverTime(item, special)); break; case SpecialProp.powerBoost: StartCoroutine(PowerOverTime(item, special)); break; default: Debug.LogWarning(item.itemName + " does not have a passive special"); break; } } }
IEnumerator PowerOverTime(Item item, SpecialItems special) { int thisItem = item.itemID; while (thisItem == item.itemID) { while (playerLo.power[(int)item.itemLoc] > 0) { int used = 0; for (int i = 0; i < playerLo.loadout.Length; i++) { if (playerLo.power[i] <= playerLo.loadout[i].itemPower - special.specialPowerUse && playerLo.loadout[i].itemLoc != item.itemLoc) { playerLo.power[i] += special.specialPowerUse; print("added " + special.specialDefence + " to " + playerLo.hitPoints[i]); used++; Debug.Log("power added"); } } if (used > 0) { playerLo.power[(int)item.itemLoc] -= special.specialPowerUse * used; } yield return(new WaitForSeconds(special.specialDuration)); } yield return(null); } }
IEnumerator HealOverTime(Item item, SpecialItems special) { int thisItem = item.itemID; while (thisItem == item.itemID) { while (playerLo.power[(int)item.itemLoc] > 0) { bool used = false; for (int i = 0; i < playerLo.loadout.Length; i++) { if (playerLo.hitPoints[i] <= playerLo.loadout[i].itemHitpoints - special.specialDefence) { playerLo.hitPoints[i] += special.specialDefence; used = true; } } if (used) { playerLo.power[(int)item.itemLoc] -= special.specialPowerUse; } yield return(new WaitForSeconds(special.specialDuration)); } yield return(null); } }
static void Main(string[] args) { var categoryResults = new Categories().GetMostPopularMoviesByGenre(IMDBCategories.Action); foreach (var catResult in categoryResults) { Console.WriteLine($"{catResult.Actors} {catResult.Id}"); Console.WriteLine($"{catResult.ImageID} {catResult.LargeImage}"); Console.WriteLine($"{catResult.MediumImage} {catResult.SmallImage}"); Console.WriteLine($"{catResult.Title} {catResult.Type} {catResult.Year}"); var movieDetails = new Movie().GetMainMoviePage(catResult.Id); Console.WriteLine($"{movieDetails?.review?.reviewBody} {movieDetails?.review?.reviewRating?.ratingValue}"); } var mostPopulalResults = new SpecialItems().GetSpecialItems(IMDBTypes.MostPopularMovies); foreach (var popResult in mostPopulalResults) { Console.WriteLine($"{popResult.Actors} {popResult.Id}"); Console.WriteLine($"{popResult.ImageID} {popResult.LargeImage}"); Console.WriteLine($"{popResult.MediumImage} {popResult.SmallImage}"); Console.WriteLine($"{popResult.Title} {popResult.Type} {popResult.Year}"); var movieDetails = new Movie().GetMainMoviePage(popResult.Id); Console.WriteLine($"{movieDetails?.review?.reviewBody} {movieDetails?.review?.reviewRating?.ratingValue}"); } Console.ReadKey(); }
GameObject SelectPowerUp() { for (int i = 0; i < ItemsPool.Count; i++) { if (ItemsPool[i].GetComponent <ItemBehaviour>().rarity == ItemBehaviour.Rarity.Common) { hasCommon = true; CommonItems.Add(ItemsPool[i]); } if (ItemsPool[i].GetComponent <ItemBehaviour>().rarity == ItemBehaviour.Rarity.Uncommon) { UncommonItems.Add(ItemsPool[i]); hasUncommon = true; } if (ItemsPool[i].GetComponent <ItemBehaviour>().rarity == ItemBehaviour.Rarity.Rare) { RareItems.Add(ItemsPool[i]); hasRare = true; } if (ItemsPool[i].GetComponent <ItemBehaviour>().rarity == ItemBehaviour.Rarity.Mythic) { MythicItems.Add(ItemsPool[i]); hasMythic = true; } if (ItemsPool[i].GetComponent <ItemBehaviour>().rarity == ItemBehaviour.Rarity.Special) { SpecialItems.Add(ItemsPool[i]); hasSpecial = true; } } ItemBehaviour.Rarity itemChoose = ChanceRandom(); Debug.Log("A Raridade do drop é: " + itemChoose); if (itemChoose == ItemBehaviour.Rarity.Common) { return(CommonItems[Random.Range(0, CommonItems.Count)]); } else if (itemChoose == ItemBehaviour.Rarity.Uncommon) { return(UncommonItems[Random.Range(0, UncommonItems.Count)]); } else if (itemChoose == ItemBehaviour.Rarity.Rare) { return(RareItems[Random.Range(0, RareItems.Count)]); } else if (itemChoose == ItemBehaviour.Rarity.Mythic) { return(MythicItems[Random.Range(0, MythicItems.Count)]); } else if (itemChoose == ItemBehaviour.Rarity.Special) { return(SpecialItems[Random.Range(0, SpecialItems.Count)]); } return(null); }
// Use this for initialization void Start () { database = GameObject.FindGameObjectWithTag ("Database"); displays = GameObject.FindGameObjectWithTag ("Background").GetComponent<UIScripts> (); spec = GameObject.FindGameObjectWithTag ("Background").GetComponent<Specials> (); specIt = GameObject.FindGameObjectWithTag ("Background").GetComponent<SpecialItems> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<Player> (); itemData = database.GetComponent<ItemData> (); attData = database.GetComponent<AttackDatabase> (); }
void StunEnemy(SpecialItems special, GameObject enemyGO) { try { EnemyController enemy = enemyGO.GetComponent <EnemyController> (); if (!enemy.GetComponent <RobotLoadout> ().stopped) { StartCoroutine(UnStunEnemy(special, enemy)); } } catch { Debug.LogWarning("Enemy Controller not found"); return; } }
IEnumerator Bleed(SpecialItems special, RobotLoadout enemyLo) { List <int> liveParts = new List <int> (); for (int i = 0; i < enemyLo.hitPoints.Length; i++) { if (enemyLo.hitPoints[i] > 0) { liveParts.Add(i); // twice as likely to hit everything but the head if (enemyLo.loadout[i].itemLoc != ItemLoc.head) { liveParts.Add(i); } } } int rand = Random.Range(0, liveParts.Count); while (enemyLo.hitPoints[liveParts[rand]] > 0 || enemyLo) { enemyLo.hitPoints[liveParts[rand]] -= special.specialDamage; yield return(new WaitForSeconds(special.specialDuration)); } }
void CreateShield(Item item, SpecialItems special) { // Make a Shield playerLo.shield = special; }
void BleedEnemy(SpecialItems special, GameObject enemy) { RobotLoadout enemyLo = enemy.GetComponent <RobotLoadout> (); StartCoroutine(Bleed(special, enemyLo)); }