コード例 #1
0
    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);
        }
    }