public void changeClass(string className) { if (className != "RogueChara") { GameObject.Find("RogueChara").GetComponent <Image>().enabled = false; } else { GameObject.Find("RogueChara").GetComponent <Image>().enabled = true; GameObject.Find("StatsValues").GetComponent <Text>().text = RogueAttack.ToString() + "\n" + RogueDefence.ToString() + "\n" + RoguePower.ToString(); GameObject.Find("ClassText").GetComponent <Text>().text = RogueText; } if (className != "MageChara") { GameObject.Find("MageChara").GetComponent <Image>().enabled = false; } else { GameObject.Find("MageChara").GetComponent <Image>().enabled = true; GameObject.Find("StatsValues").GetComponent <Text>().text = MageAttack.ToString() + "\n" + MageDefence.ToString() + "\n" + MagePower.ToString(); GameObject.Find("ClassText").GetComponent <Text>().text = MageText; } if (className != "WarriorChara") { GameObject.Find("WarriorChara").GetComponent <Image>().enabled = false; } else { GameObject.Find("WarriorChara").GetComponent <Image>().enabled = true; GameObject.Find("StatsValues").GetComponent <Text>().text = WarriorAttack.ToString() + "\n" + WarriorDefence.ToString() + "\n" + WarriorPower.ToString(); GameObject.Find("ClassText").GetComponent <Text>().text = WarriorText; } }
private void attack( ) { Vector2 dir = (_player.transform.position - this.transform.position).normalized; bool right = true; if (dir.x < 0) { right = false; } SpriteRenderer render = GetComponent <SpriteRenderer>( ); MOVE_ANIM now_dir = getMoveDir( ); if (right && now_dir == MOVE_ANIM.MoveLeft) { render.flipX = !render.flipX; _turn = true; } if (!right && now_dir == MOVE_ANIM.MoveRight) { render.flipX = !render.flipX; _turn = true; } MageAttack fire_magic = GetComponent <MageAttack>( ); if (!fire_magic.isReload( )) { return; } runAttackAnim( ); fire_magic.setDir(dir); }
/// <summary> /// Load Mage level data. /// </summary> /// <param name="mageObject">Mage object.</param> public void LoadLevelData(GameObject mageObject) { Mage mage = mageObject.GetComponent <Mage> (); if (mage.level == 0) { return; } MageAttack mageAttack = mageObject.GetComponentInChildren <MageAttack> (); //テキストダータお、文字列として取り込む string level_texts = level_data_text.text; //改行ごとに分割し、文字列の配列に入れる string[] lines = level_texts.Split('\n'); //lines内お各行に対して、順番に処理していくループ foreach (var line in lines) { if (line == "") //行が空っぽなら { continue; //以下の処理はせずいループの先頭にジャンプ } string[] words = line.Split(); if (words[0].StartsWith("#") || words[0].StartsWith("@")) //ワードの先頭文字が#か@なら { continue; //ループを脱出 } if (mage.level == int.Parse(words [0])) //レベルが違うなら { int n = 0; //words内の各ワードに対して、順番に処理していくループ foreach (var word in words) { if (word == "") //ワードが空っぽなら { continue; //ループの先頭にジャンプ } //「n」の値を0,1,2,...と変化させていく //各ワードを数値に変換し、それぞれ格納する switch (n) { case 1: mage.cost = int.Parse(word); break; case 2: mage.castTime = float.Parse(word); break; case 3: mage.power = int.Parse(word); break; case 4: mage.XZ_Blowing = float.Parse(word); break; case 5: mage.Y_Blowing = float.Parse(word); break; case 6: mage.breakPower = float.Parse(word); break; case 8: mageObject.GetComponentInChildren <XffectComponent> ().Scale = float.Parse(word); try{ mageObject.transform.localScale = new Vector3(float.Parse(word), float.Parse(word), float.Parse(word)); }catch (MissingComponentException e) { Debug.LogError(e); } break; default: break; } n++; } break; } } }
public MageCharacter(string name, int level, int experience) : base(name, level, experience) { AddActionToList(MageAttack.GetActionBuilder()); armorMod = 3; }
public MageCharacter(string name) : base(name) { AddActionToList(MageAttack.GetActionBuilder()); armorMod = 3; }