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 Start() { Ability1 = TeamController.Team.Mem[0]; Ability2 = TeamController.Team.Mem[1]; rect = HPBar.GetComponent <RectTransform>(); MaxW = rect.sizeDelta.x; ba = GameConfig.Controller.GetComponent <BindAbility>(); Reset(); }
private void Awake() { if (BindTeam > -1) { Ability = TeamController.Team.Mem[BindTeam]; } else { MaxW = HPBar.transform.localScale.x; } }
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); } } } }
private void Awake() { SkillManager.AcB = this; Lights = Lighten.GetComponent <Light>(); Vector3 v = GameObject.Find("Fighter1").transform.position; BZ = v.z; FX1 = v.x; BY = v.y; v = GameObject.Find("Fighter2").transform.position; FX2 = v.x; Vector3 v2 = Camera.main.transform.position; cox = v2.x; coy = v2.y; coz = v2.z; #region 加载我方和敌方成员 F1 = new List <FighterController>(); F2 = new List <FighterController>(); GameObject fab = (GameObject)Resources.Load("Prefabs\\Fighter"); GameObject fab2 = (GameObject)Resources.Load("Prefabs\\TeamInfo"); TeamController.Team.Mem.Clear(); TeamController.Team.Mem.Add(new TeamController.Member("世原·安诺")); TeamController.Team.Mem.Add(new TeamController.Member("兮·御冯")); for (int i = 0; i < TeamController.Team.Mem.Count; i++) { TeamController.Member m = TeamController.Team.Mem[i]; GameObject box = Instantiate(fab, new Vector3(FX1 - i * 0.5f, BY, BZ - i * 2), Quaternion.identity, this.transform.parent); FighterController f = box.GetComponent <FighterController>(); f.character = m.Name; f.IsEne = false; f.BindMember = m; f.Up(); F1.Add(f); box.SetActive(true); /**box = * Instantiate(fab2,new Vector3(160+i*150,220,0), * Quaternion.identity,this.transform); * box.GetComponent<RectTransform>().localScale = new Vector3(0.4f,0.4f,0.4f); * box.GetComponent<TeamInfoController>().BindMember = f.BindMember; * box.GetComponent<TeamInfoController>().UpdateInfo(); * box.SetActive(true);**/ } TeamController.Team.Mem.Clear(); TeamController.Team.Mem.Add(new TeamController.Member("雪郎·梦亭")); TeamController.Team.Mem.Add(new TeamController.Member("素鱼·艾桑")); for (int i = 0; i < TeamController.Team.Mem.Count; i++) { TeamController.Member m = TeamController.Team.Mem[i]; GameObject box = Instantiate(fab, new Vector3(FX2 + i * 0.5f, BY, BZ - i * 2), Quaternion.identity, this.transform.parent); FighterController f = box.GetComponent <FighterController>(); f.character = m.Name; f.IsEne = true; f.BindMember = m; f.Up(); F2.Add(f); box.SetActive(true); } #endregion GameObject.Find("Fighter1").SetActive(false); GameObject.Find("Fighter2").SetActive(false); Msg.Add("双方的较量开始了!"); Msg.Add("道具和动作还不能使用..."); FetchRound(); }