void EneUse() { List <SkillManager.Skill> sk = new List <SkillManager.Skill>(); for (int i = 0; i < 3; i++) { sk.Add(SkillManager.S.Find(m => m.Name == Rounds[0].BindMember.Magics[i])); } sk = sk.FindAll(m => m.MP <= Rounds[0].BindMember.MP); lSk = sk[Random.Range(0, sk.Count)]; List <FighterController> lt; if (lSk.Strength >= 0) { lt = F1.FindAll(m => m.BindMember.HP > 0); } else { lt = F2.FindAll(m => m.BindMember.HP > 0); } tar = lt[Random.Range(0, lt.Count)]; Msg.Add(Rounds[0].BindMember.Name + "对" + tar.BindMember.Name + "使用了“" + lSk.Name + "”!"); Rounds[0].State = FighterController.BattleState.Magic; BattleStep = 3; ttick = 0; }
public void CoolDownSkill(SkillManager.Skill skill, float duration) { Image cooldownOverlay = null, skillImage = null; switch (skill) { case SkillManager.Skill.ANTI_GRAVITY: skillImage = antigravityBtn.GetComponent <Image>(); cooldownOverlay = SharedUtilities.GetInstance().GetFirstChildrenWithComponent <Image>(antigravityBtn).GetComponent <Image>(); break; case SkillManager.Skill.QUANTUM_TUNNEL: skillImage = quantumTunnelBtn.GetComponent <Image>(); cooldownOverlay = SharedUtilities.GetInstance().GetFirstChildrenWithComponent <Image>(quantumTunnelBtn).GetComponent <Image>(); break; case SkillManager.Skill.SOLAR_FLARE: skillImage = solarflareBtn.GetComponent <Image>(); cooldownOverlay = SharedUtilities.GetInstance().GetFirstChildrenWithComponent <Image>(solarflareBtn).GetComponent <Image>(); break; case SkillManager.Skill.GAMMARAY_BURST: skillImage = gammaRayBurstBtn.GetComponent <Image>(); cooldownOverlay = SharedUtilities.GetInstance().GetFirstChildrenWithComponent <Image>(gammaRayBurstBtn).GetComponent <Image>(); break; } skillImage.raycastTarget = false; SharedUtilities.GetInstance().UnfillImage <Image>(this, cooldownOverlay, duration, EnableRayCastTarget, skillImage); }
public void ProcessAttack(float deepth, SkillManager.Skill s, TeamController.Member m1) { if (Recovery) { return; } float Injury = s.Strength * m1.ATK; Injury /= 1.5f; if (s.Strength > 0) { Injury -= Ability.DEF; } float Source = Injury; int type = 0; Injury *= TeamController.JC[(int)s.Job - 1, (int)Ability.Job[0] - 1]; Injury *= TeamController.JC[(int)s.Job - 1, (int)Ability.Job[1] - 1]; type = (Injury > Source ? 2 : 1); Injury *= deepth; Ability.HP -= Injury; HPDisplayer.CreateHPAnimate(this.transform.localPosition, Mathf.Ceil(Injury), type); if (Ability.HP <= 0) { HPDisplayer.CreateKillAnimate(this.transform.localPosition); } }
void Update() { s.CDa += Time.deltaTime; if (s.CDa > s.CD) { s.CDa = s.CD; } Mask.color = new Color(1f, 1f, 1f, 1f - s.CDa / s.CD); bool Pressed = false; if (SkillIndex == 0 && Input.GetKeyUp(KeyCode.X)) { Pressed = true; } if (SkillIndex == 1 && Input.GetKeyUp(KeyCode.C)) { Pressed = true; } if (SkillIndex == 2 && Input.GetKeyUp(KeyCode.V)) { Pressed = true; } if (GameConfig.IsTouched(this.gameObject)) { Pressed = true; } if (Pressed) { if (GameConfig.ExS != "") { GameConfig.ExS = s.Name; MagicExchange me = GameConfig.ExMObj.GetComponent <MagicExchange>(); s = SkillManager.S.Find(m => m.Name == me.ExMagic); me.ExMagic = GameConfig.ExS; me.ReLoad(); ReLoad(); /**MSBC msbc = GameConfig.ExMObj.GetComponent<MSBC>(); * msbc.s = SkillManager.S.Find(m => m.Name == GameConfig.ExS); * msbc.ReLoad();**/ } else { if (s.CDa < s.CD) { return; } s.CDa = 0; SkillManager.MakeFireworks(s, GameConfig.Controller.transform.localPosition, GameConfig.Controller); } } }
void FixedUpdate() { HPText.text = "HP " + Mathf.Ceil(ba.Ability.HP) + "/" + ba.Ability.MaxHP; rect.sizeDelta = new Vector2(ba.Ability.HP / ba.Ability.MaxHP * MaxW, rect.sizeDelta.y); //角色死亡处理 DieScreen.SetActive(ba.Recovery); if (ba.Recovery) { return; } bool ExV = (GameConfig.ExS != ""); ExBar.SetActive(ExV); ExSkill.SetActive(ExV); if (GameConfig.ExS != lSkill && ExV) { lSkill = GameConfig.ExS; SkillManager.Skill s = SkillManager.S.Find(m => m.Name == GameConfig.ExS); s.CD /= 5; ExSkill.GetComponent <MSBC>().s = s; ExSkill.GetComponent <MSBC>().ReLoad(); } //Role Switcher if (Input.GetKeyUp(KeyCode.Q) || GameConfig.IsTouched(Switcher)) { ControlRole = (ControlRole == 0) ? 1 : 0; RPGEvent rpg = GameConfig.Controller.GetComponent <RPGEvent>(); GameConfig.Followers[0].character = rpg.character; GameConfig.Followers[0].Confirm(); rpg.character = TeamController.Team.Mem[ControlRole].Name; rpg.Reload(); if (ControlRole == 0) { Ability2 = ba.Ability; } if (ControlRole == 1) { Ability1 = ba.Ability; } Reset(); SkillManager.PlaySkillAni(GameConfig.Controller.transform.localPosition, "Interactive\\Stars\\StarExplosion"); } //Touch Hander foreach (Touch t in Input.touches) { if (t.phase == TouchPhase.Ended) { GraphicRaycaster gr = this.GetComponent <GraphicRaycaster>(); PointerEventData data = new PointerEventData(EventSystem.current); data.pressPosition = t.position; data.position = t.position; List <RaycastResult> results = new List <RaycastResult>(); gr.Raycast(data, results); GameConfig.TouchAt.Clear(); foreach (RaycastResult rr in results) { GameConfig.TouchAt.Add(rr.gameObject); } } } }
public void SetInfo(int index) { s = SkillManager.S.Find(m => m.Name == TeamController.Team.Mem[index].Magics[SkillIndex]); s.CD /= 5; ReLoad(); }
void Carry(string name, GameObject go) { if (name == DialogB.name) { DialogB.SetActive(false); DialogB.SetActive(true); SoundPlayer.Play("Cursor1"); Msg.Remove(Msg[0]); } if (name == "ATK") { BattleStep = 1; SkillInfoController Si; for (int i = 0; i < 3; i++) { Si = SkillBoard.transform.Find("Skill" + (i + 1)).GetComponent <SkillInfoController>(); Si.BindS = SkillManager.S.Find(m => m.Name == Rounds[0].BindMember.Magics[i]); Si.UpdateInfo(); SkillBoard.transform.Find("InfoText").GetComponent <Text>().text = "MP " + Rounds[0].BindMember.MP + " / " + Rounds[0].BindMember.MaxMP; } string TeamStr = "", HColor = ""; for (int i = 0; i < F1.Count; i++) { float f = F1[i].BindMember.HP / F1[i].BindMember.MaxHP; if (f >= 0.3f) { HColor = "orange"; } if (f < 0.3f) { HColor = "red"; } if (f >= 0.6f) { HColor = "green"; } TeamStr += F1[i].BindMember.Name + " <color=" + HColor + ">" + F1[i].BindMember.HP + " / " + F1[i].BindMember.MaxHP + "</color>\n"; } SkillBoard.transform.Find("TeamText").GetComponent <Text>().text = TeamStr; } if (name == "NextBtn") { //BattleStep = 2; } if (name == "PrevBtn") { Debug.Log("Prev"); BattleStep = 1; } if (name.StartsWith("Team") && name != "TeamText") { List <FighterController> lt = F2; if (lSk.Strength >= 0) { lt = F2; } else { lt = F1; } tar = lt.Find(m => m.BindMember.Equals(go.GetComponent <TeamInfoController>().BindMember)); Msg.Add(Rounds[0].BindMember.Name + "对" + tar.BindMember.Name + "使用了“" + lSk.Name + "”!"); Rounds[0].State = FighterController.BattleState.Magic; BattleStep = 3; ttick = 0; } if (name.StartsWith("Skill") && name != "SkillBoard") { //Debug.Log("Skill?"); List <FighterController> lt = F2; SkillInfoController Sk = SkillBoard.transform.Find(name).GetComponent <SkillInfoController>(); SkillManager.Skill sk = Sk.BindS; if (sk.MP > Rounds[0].BindMember.MP) { MessageCreator.CreateMsg("魔力不足", "你无法使用这个魔法。"); return; } lSk = sk; //Debug.Log(Sk.name); if (lSk.Strength >= 0) { lt = F2.FindAll(m => m.BindMember.HP > 0); } else { lt = F1.FindAll(m => m.BindMember.HP > 0); } for (int i = 0; i < 4; i++) { if (i >= lt.Count) { Teams[i].SetActive(false); } else { Teams[i].SetActive(true); Teams[i].GetComponent <TeamInfoController>().BindMember = lt[i].BindMember; Teams[i].GetComponent <TeamInfoController>().UpdateInfo(); } } BattleStep = 2; } }
public void ReLoad() { SkillManager.Skill s = SkillManager.S.Find(m => m.Name == ExMagic); this.transform.Find("Icon").GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Job\\s" + (int)s.Job); }