コード例 #1
0
    void Update()
    {
        // TODO: implementar movimentação aleatória, será necessário implementar sistema de comandos
        var mov = new Vector3(0, 0, 0);

        if (Input.GetKey(KeyCode.UpArrow))
        {
            mov.y = 1;
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            mov.y = -1;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            mov.x = -1;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            mov.x = 1;
        }

        moviment = mov.normalized;
        animatorController.PlayWalkAnimation(moviment);

        if (Input.GetKeyDown(KeyCode.RightControl))
        {
            dashMoviment = true;
        }
    }
コード例 #2
0
    void Update()
    {
        var mov = new Vector3(0, 0, 0);

        if (moves.Contains("up"))
        {
            mov.y = 1;
        }

        if (moves.Contains("down"))
        {
            mov.y = -1;
        }

        if (moves.Contains("left"))
        {
            mov.x = -1;
        }

        if (moves.Contains("right"))
        {
            mov.x = 1;
        }

        moviment = mov.normalized;
        animatorController.PlayWalkAnimation(moviment);
    }