public Hero(HeroType tipehero) { switch (tipehero) { case HeroType.DURABLE: { HP = 1500; MP = 200; ATK = 100; DEF = 50; REC = 15; SPD = 10; TipeHero = tipehero.ToString(); break; } case HeroType.ATTACK: { HP = 800; MP = 300; ATK = 250; DEF = 40; REC = 5; SPD = 40; TipeHero = tipehero.ToString(); break; } case HeroType.MAGIC: { HP = 750; MP = 600; ATK = 75; DEF = 35; REC = 10; SPD = 30; TipeHero = tipehero.ToString(); break; } case HeroType.HEALER: { HP = 1000; MP = 500; ATK = 80; DEF = 25; REC = 50; SPD = 35; TipeHero = tipehero.ToString(); break; } case HeroType.SPLASH: { HP = 950; MP = 200; ATK = 65; DEF = 20; REC = 15; SPD = 20; TipeHero = tipehero.ToString(); break; } } }
public static void BuyItem(DLCType dt2) { string s = ShopManager.selected.ToString() + ":" + ((DLCType)dt2).ToString(); if (ContentManager.data.purchases.Contains(s)) { return; } if (ContentManager.data.coins < getPrice(dt2)) { return; } ContentManager.data.purchases.Add(s); ContentManager.data.coins -= getPrice(dt2); Saver.save(ContentManager.data); Bars.update(); foreach (Transform child in dict[dt2].transform) { if (child.name == "Buy") { child.gameObject.SetActive(false); } else if (child.name == "Puton") { child.gameObject.SetActive(true); } } foreach (DLCType dt in Enum.GetValues(typeof(DLCType)).Cast <DLCType>()) { foreach (Transform child in dict[dt].transform) { if (child.name == "Buy" && (ContentManager.data.purchases.Contains(selected.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins < getPrice(dt))) { child.gameObject.SetActive(false); } else if (child.name == "Nuy") { child.gameObject.SetActive(true); } if (child.name == "NotEnoughMoney" && (ContentManager.data.purchases.Contains(selected.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins >= getPrice(dt))) { child.gameObject.SetActive(false); } else if (child.name == "NotEnoughMoney") { child.gameObject.SetActive(true); } } } }
public void InsChoiseHero(HeroType heroType) { if (heroType != HeroType.None) { ChoiseHero = heroType; if (INSHero != null) { Destroy(INSHero); } var INSPOS = GameObject.Find("INSCHPOS").transform.position; INSHero = Instantiate(Resources.Load("Prefab/HeroChoose/" + ChoiseHero.ToString()), INSPOS, Quaternion.identity) as GameObject; INSHero.transform.LookAt((new Vector3(INSHero.transform.position.x, INSHero.transform.position.y, INSHero.transform.position.z - 1))); //生成特效 if (SpawnFX2 == null) { SpawnFX2 = Instantiate(Resources.Load("Prefab/HeroChoose/SpawnFX2"), INSPOS, Quaternion.identity) as GameObject; } if (SpawnFX == null) { SpawnFX = Instantiate(Resources.Load("Prefab/HeroChoose/SpawnFX"), INSPOS, Quaternion.identity) as GameObject; } else { SpawnFX.SetActive(true); } } }
public Counter(HeroType ht) { this.ht = ht; string s = TypeUtils.getName(ht).Replace(" ", ""); if (ContentManager.data == null) { ContentManager.data = Saver.load(); } string data = (string)ContentManager.data.GetType().GetField(ht.ToString().ToLower()).GetValue(ContentManager.data); DLCType?type = getType(data); if (type != null) { working = true; this.type = (DLCType)type; Sprite sprite = Dot.typeToSprite(ht, this.type); go1 = GameObject.FindGameObjectWithTag(s); go2 = GameObject.FindGameObjectWithTag(s + "Bar"); Image img = go1.GetComponent <Image>(); img.color = new Color(1f, 1f, 1f, 0.4f); img.sprite = sprite; Image img2 = go2.GetComponent <Image>(); img2.color = new Color(1f, 1f, 1f, 1f); img2.sprite = sprite; } }
public DotData(HeroType ht, DLCType dt, OnType ot, string position) { this.position = position; type = ht.ToString(); dtype = dt.ToString(); otype = ot.ToString(); }
Sprite GetSpriteByType(HeroType type) { // Debug.Log("Path " + "Img/Icon/" + type.ToString() + "Icon" ); Sprite res = Resources.Load <Sprite>("Img/Icon/" + type.ToString() + "Icon"); // Debug.Log("REs " + res ); return(res); }
static GameObject CreateHeroByType(HeroType type) { string path = "Hero/" + type.ToString() + "Hero"; GameObject heroPrefab = Resources.Load <GameObject>(path); GameObject newHero = GameObject.Instantiate(heroPrefab) as GameObject; return(newHero); }
public void JoinRequest(HeroType heroType) { var data = new Dictionary <byte, object> { { (byte)ParaType.BFOther, ParaCode.BF_Join }, { (byte)ParaCode.BF_Join, heroType.ToString() } }; Debug.Log(data.Count); PhotonEngine.peer.OpCustom((byte)OpCode, data, true); }
public static HeroPowerUpListData GetPowerUpListData(HeroType heroType) { foreach (HeroData data in instance.heroData) { if (data.heroType == heroType) { return(data.powerUpData); } } throw new UnityEngine.Assertions.AssertionException (instance.GetType() + ".cs", "Could not find data for hero with name " + heroType.ToString() + "!"); }
public void Save() { PlayerPrefs.SetString(SaveKeys.HERO_TYPE, heroType.ToString()); PlayerPrefs.SetString(SaveKeys.NAME, playerName); PlayerPrefs.SetInt(SaveKeys.LEVEL, level); PlayerPrefs.SetInt(SaveKeys.HP_MAX, hpMax); PlayerPrefs.SetInt(SaveKeys.MP_MAX, mpMax); PlayerPrefs.SetFloat(SaveKeys.HP_REMAIN, hp_remain); PlayerPrefs.SetFloat(SaveKeys.MP_REMAIN, mp_remain); PlayerPrefs.SetFloat(SaveKeys.EXP, exp); PlayerPrefs.SetFloat(SaveKeys.ATTACK_BASE, attack_base); PlayerPrefs.SetFloat(SaveKeys.DEFENSE_BASE, defense_base); PlayerPrefs.SetFloat(SaveKeys.SPEED_BASE, speed_base); PlayerPrefs.SetInt(SaveKeys.ATTACK_PLUS, attack_plus); PlayerPrefs.SetInt(SaveKeys.DEFENSE_PLUS, defense_plus); PlayerPrefs.SetInt(SaveKeys.SPEED_PLUS, speed_plus); PlayerPrefs.SetInt(SaveKeys.POINT_REMAIN, point_remain); }
private IDecisionNode FitPolicyToHero(HeroType heroType, List <Episode> episodes, Policy policy) { DecisionNodeAccuracy rootAccuracy = CalculateDecisionTree(episodes); IDecisionNode root = rootAccuracy.Root; Console.WriteLine(string.Format( "GPU: Policy [{0}] ({1} leaves from {2} episodes) accuracy: {3}", heroType == HeroType.None ? "All" : heroType.ToString(), CountLeaves(root), episodes.Count, rootAccuracy.Accuracy)); return(root); }
private async Task <IDecisionNode> FitPolicyToHero(HeroType heroType, List <Episode> episodes, Policy policy) { double grandTotalWeight = episodes.Sum(x => x.Weight); DecisionNodeAccuracy decisionNodeAccuracy = await OptimalDecisionNode(episodes, grandTotalWeight); Console.WriteLine(string.Format( "CPU: Policy [{0}] ({1} leaves from {2} episodes) accuracy: {3}", heroType == HeroType.None ? "All" : heroType.ToString(), CountLeaves(decisionNodeAccuracy.DecisionNode), episodes.Count, decisionNodeAccuracy.CorrectWeight / grandTotalWeight)); return(decisionNodeAccuracy.DecisionNode); }
public override string ToString() { if (!hasValue) { return(Type.ToString()); } string valueText = ValueText; if (valueText != null) { return(Type + ": " + valueText); } else { return(Type + ": null"); } }
// Load common sprites for any hero static void BuildGeneric(HeroType type, HeroSprites sprites) { // Idle, Walk, Jump, Kneel, Swing, Defend, Cast, Item, Struck, Dead, Victory, string prefix = @"Sprites\Hero\" + type.ToString(); sprites.Portrait = Resources.Load <Sprite>(prefix + Stance.Portrait.ToString()); sprites.Idle = Resources.Load <Sprite>(prefix + Stance.Idle.ToString()); sprites.Walk[0] = sprites.Idle; sprites.Walk[1] = Resources.Load <Sprite>(prefix + Stance.Walk.ToString() + "0"); sprites.Walk[2] = sprites.Idle; sprites.Walk[3] = Resources.Load <Sprite>(prefix + Stance.Walk.ToString() + "1"); sprites.Jump[0] = Resources.Load <Sprite>(prefix + Stance.Jump.ToString() + "0"); sprites.Jump[1] = Resources.Load <Sprite>(prefix + Stance.Jump.ToString() + "1"); sprites.Kneel = Resources.Load <Sprite>(prefix + Stance.Kneel.ToString()); sprites.Swing = Resources.Load <Sprite>(prefix + Stance.Swing.ToString()); sprites.Defend = Resources.Load <Sprite>(prefix + Stance.Defend.ToString()); sprites.Cast[0] = Resources.Load <Sprite>(prefix + Stance.Cast.ToString() + "0"); sprites.Cast[1] = Resources.Load <Sprite>(prefix + Stance.Cast.ToString() + "1"); sprites.Item = Resources.Load <Sprite>(prefix + Stance.Item.ToString()); sprites.Struck = Resources.Load <Sprite>(prefix + Stance.Struck.ToString()); sprites.Dead = Resources.Load <Sprite>(prefix + Stance.Dead.ToString()); sprites.Victory = Resources.Load <Sprite>(prefix + Stance.Victory.ToString()); }
public void Spawn() => RawWrite(_heroType.ToString().ToUpper());
public LevelData getLevel() { List <DotData> dots = new List <DotData>(); foreach (Dot d in Form1.dots.Values) { if (d.getHType() == HeroType.RANDOM && ((!Form1.ons.ContainsKey(d)) || (ons[d].getOType() == OnType.NONE))) { continue; } OnType ot; if (Form1.ons.ContainsKey(d)) { ot = Form1.ons[d].getOType(); } else { ot = OnType.NONE; } if (d.getHType() == HeroType.RANDOM) { dots.Add(new DotData("NONE", d.getDType(), ot, d.getX() + ":" + d.getY())); } else { dots.Add(new DotData(d.getHType().ToString(), d.getDType(), ot, d.getX() + ":" + d.getY())); } } Dictionary <HeroType, TargetData> targets = new Dictionary <HeroType, TargetData>(); Dictionary <OnType, TargetData> targets2 = new Dictionary <OnType, TargetData>(); foreach (DataGridViewRow row in instance.targetsData.Rows) { if (hts.ContainsKey((string)row.Cells["type"].Value)) { Console.WriteLine("1"); HeroType ht = hts[(string)row.Cells["type"].Value]; int i = Decimal.ToInt32((decimal)row.Cells["number"].Value); targets.Add(ht, new TargetData(ht.ToString(), "", 1)); } else if (ots.ContainsKey((string)row.Cells["type"].Value)) { Console.WriteLine("2"); OnType ot = ots[(string)row.Cells["type"].Value]; targets2.Add(ot, new TargetData("", ot.ToString(), Decimal.ToInt32((decimal)row.Cells["number"].Value))); } } List <TargetData> list = new List <TargetData>(); list.AddRange(targets.Values); list.AddRange(targets2.Values); return(new LevelData(dots, list.ToList(), (int)stepsBox.Value, (int)energyBox.Value)); }
public string getName(HeroType ht) { return(getName(ht.ToString())); }
private GameObject LoadHero(HeroType heroType) { return(Resources.Load <GameObject>(String.Format(Helps.HeroesPath + heroType.ToString()))); }
public override string ToString() { return(heroType.ToString()); }
public static void SelectIcon(HeroType ht) { if (ht == HeroType.CONCRETE || ht == HeroType.NONE) { return; } foreach (Transform t in content.transform) { Destroy(t.gameObject); } dict.Clear(); foreach (DLCType dt in Enum.GetValues(typeof(DLCType)).Cast <DLCType>()) { GameObject item = GameObject.Instantiate(ShopManager.item, new Vector3(0f, 0f, 1f), Quaternion.identity, content.transform); string ds = (string)ContentManager.data.GetType().GetField(ht.ToString().ToLower()).GetValue(ContentManager.data); DLCType? main = TypeUtils.getDType(ds); foreach (Transform child in item.transform) { if (child.name == "Icon") { child.GetComponent <Image>().sprite = Board.rs.sprites[new KeyValuePair <HeroType, DLCType>(ht, dt)]; } if (child.name == "Price") { if (dt == DLCType.NONE) { child.gameObject.SetActive(false); } else { child.GetComponent <Text>().text = getPrice(dt) + " Монет"; } } if (child.name == "Takeoff" && main != null && main == dt) { child.gameObject.SetActive(true); } if (child.name == "Buy" && (ContentManager.data.purchases.Contains(ht.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins < getPrice(dt))) { child.gameObject.SetActive(false); } if (child.name == "NotEnoughMoney" && (ContentManager.data.purchases.Contains(ht.ToString() + ":" + dt.ToString()) || dt == DLCType.NONE || ContentManager.data.coins >= getPrice(dt))) { child.gameObject.SetActive(false); } if (child.name == "Puton" && ((ContentManager.data.purchases.Contains(ht.ToString() + ":" + dt.ToString()) && !(main != null && main == dt)) || (dt == DLCType.NONE && ds != ""))) { child.gameObject.SetActive(true); } } dict.Add(dt, item); } foreach (Transform child in GameObject.FindGameObjectWithTag("ShopIcons").transform) { if (child.name == TypeUtils.getName(ht).Replace(" ", "")) { child.GetComponent <Image>().material = null; } else { child.GetComponent <Image>().material = outline; } } selected = ht; }
public override string ToString() { return(string.Format("[Pawn: type={0}, id={1}, level={2}]", type.ToString(), id, level)); }
public override string ToString() { return(string.Format("ID: {2}, type: {3} , block:({0},{1}) , direction {4}, aglie {5}", m_i, m_j, ID, type.ToString(), direction, aglie)); }
public override string ToString() { return(string.Format("[Quest] Play as {0}", type.ToString())); }