static void SendSkillOpt(int id) { var opt = new FramOpt(); opt.Optype = Client.SKILLTYPE; opt.Doplayername = Client.name; opt.Skillid = id; Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time; }
static void UpdateYaogan() { //hor = 遥感脚本中的localPosition.x// float hor = touch.Horizontal; //hor = 遥感脚本中的localPosition.y float ver = touch.Vertical; Vector3 direction = new Vector3(hor, 0, ver); FramOpt opt = new FramOpt(); opt.Doplayername = Client.name; if (direction != Vector3.zero) { opt.Optype = Client.MOVETYPE; var Direction = Quaternion.LookRotation(direction); opt.Dir = ((int)((Direction.eulerAngles.y + 7.5f) / 15.0f) + follow.GetCameraDir()) % 24; if (Time.time - pret >= 0.01f) { Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time; } //Debug.Log("direction :::: " + Direction); //Debug.Log("direction y : " + Direction.eulerAngles.y + " dir " + opt.Dir); } else { //站立状态 opt.Optype = Client.SKILLTYPE; opt.Skillid = 0; if (Time.time - pret >= 0.1f) { Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time; } } if (Input.GetKeyDown("x") || Input.GetKey("x")) { PlaySkillA(); } else if (Input.GetKeyDown("c") || Input.GetKey("c")) { /*opt.Optype = Client.SKILLTYPE; * opt.Skillid = 5; * Client.Send(Client.FRAMOPTYPE,opt); * pret = Time.time;*/ PlaySkillD(); } else if (Input.GetKeyDown("a") || Input.GetKey("a")) { PlaySkill1(); } else if (Input.GetKeyDown("s") || Input.GetKey("s")) { PlaySkill2(); } else if (Input.GetKeyDown("d") || Input.GetKey("d")) { PlaySkill3(); } else if (Input.GetKeyDown("p")) { PlaySkillBeAttacked(); } else if (Input.GetKeyDown(KeyCode.Space) || Input.GetKey(KeyCode.Space)) { PlaySkillB(); } else if (Input.GetKeyDown("o")) { var optt = new FramOpt(); optt.Optype = Client.SKILLTYPE; optt.Doplayername = "shabao"; optt.Skillid = 0; optt.Id = 2; Client.Send(Client.FRAMOPTYPE, optt); pret = Time.time; } else if (Input.GetKeyDown("f") || Input.GetKey("f")) { PlaySkill4(); } else if (Input.GetKeyDown("l") || Input.GetKey("l")) { if (Logic.obinfmp.ContainsKey("shabao")) { Logic.obinfmp["shabao"].HPRecover(100); } Logic.obinfmp[Client.name].MPRecover(100); } }
void ListenKey() { FramOpt opt = new FramOpt(); opt.Doplayername = Client.name; bool ok = false; if (Input.GetKey(KeyCode.UpArrow)) { opt.Optype = Client.MOVETYPE; opt.Dir = 0; Client.Send(Client.FRAMOPTYPE, opt); ok = true; pret = Time.time; } if (Input.GetKey(KeyCode.RightArrow)) { opt.Optype = Client.MOVETYPE; opt.Dir = 6; Client.Send(Client.FRAMOPTYPE, opt); ok = true; pret = Time.time; } if (Input.GetKey(KeyCode.DownArrow)) { opt.Optype = Client.MOVETYPE; opt.Dir = 12; Client.Send(Client.FRAMOPTYPE, opt); ok = true; pret = Time.time; } if (Input.GetKey(KeyCode.LeftArrow)) { opt.Optype = Client.MOVETYPE; opt.Dir = 18; Client.Send(Client.FRAMOPTYPE, opt); ok = true; pret = Time.time; } if (Input.GetKeyDown("x") || Input.GetKey("x")) { opt.Optype = Client.SKILLTYPE; opt.Skillid = 4; Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time; ok = true; } if (Input.GetKeyDown("c") || Input.GetKey("c")) { opt.Optype = Client.SKILLTYPE; opt.Skillid = 5; Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time; ok = true; } if (!ok && Time.time - pret >= 0.1f) { opt.Optype = Client.SKILLTYPE; opt.Skillid = 0; Client.Send(Client.FRAMOPTYPE, opt); pret = Time.time + 2f; } }