Exemplo n.º 1
0
    void MovementUpdate()
    {
        v = 0.0f;
        h = 0.0f;
        bool move = false;

        //w键前进
        h = moveJoystick.Horizontal();
        v = moveJoystick.Vertical();
        if (v != 0.0f || h != 0.0f)
        {
            move = true;
        }

        if (move && transparent == true)
        {
            GameObject model     = GameObject.Find("model");
            Material[] _material = model.GetComponent <SkinnedMeshRenderer>().materials;
            Color      temp1     = _material[0].color;
            Color      temp2     = _material[1].color;
            _material[0].SetColor("_Color", new Color(temp1[0], temp1[1], temp1[2], 1.0f));
            _material[1].SetColor("_Color", new Color(temp2[0], temp2[1], temp2[2], 1.0f));
            transparent = false;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        m_animator.SetBool("Grounded", true);
        float h = moveJoystick.Horizontal();
        float v = moveJoystick.Vertical();

        Debug.Log(new Vector2(h, v));

        float dis = (new Vector3(h, 0, v)).magnitude;

        transform.position = this.transform.position + new Vector3(h, 0, v) * Speed * Time.deltaTime;
        if (h != 0 || v != 0)
        {
            Rotating(h, v);
        }
        m_animator.SetFloat("MoveSpeed", dis);
    }