Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (b)
        {
            if (UnityEngine.Input.GetKey(KeyCode.W))
            {
                moveCount1 = 0;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.S))
            {
                moveCount1 = 1;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.A))
            {
                moveCount1 = 2;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.D))
            {
                moveCount1 = 3;
                move1      = true;
            }
            if (move1)
            {
                p.takeDmg(j.getMove(moveCount1));
                t.changeTurn();
            }
        }

        else
        {
            if (UnityEngine.Input.GetKey(KeyCode.UpArrow))
            {
                moveCount2 = 0;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.DownArrow))
            {
                moveCount2 = 1;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.LeftArrow))
            {
                moveCount2 = 2;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.RightArrow))
            {
                moveCount2 = 3;
                move2      = true;
            }
            if (move2)
            {
                j.takeDmg(p.getMove(moveCount2));
                t.changeTurn();
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (b)
        {
            if (UnityEngine.Input.GetKey(KeyCode.W))
            {
                moveCount1 = 0;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.S))
            {
                moveCount1 = 1;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.A))
            {
                moveCount1 = 2;
                move1      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.D))
            {
                moveCount1 = 3;
                move1      = true;
            }
            if (move1)
            {
                Move one = j.getMove(moveCount1);
                p.takeDmg(one.getDamage());
                t.changeTurn();
            }
        }

        else
        {
            if (UnityEngine.Input.GetKey(KeyCode.UpArrow))
            {
                moveCount2 = 0;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.DownArrow))
            {
                moveCount2 = 1;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.LeftArrow))
            {
                moveCount2 = 2;
                move2      = true;
            }
            else if (UnityEngine.Input.GetKey(KeyCode.RightArrow))
            {
                moveCount2 = 3;
                move2      = true;
            }
            if (move2)
            {
                Move two = p.getMove(moveCount2);
                j.takeDmg(two.getDamage());
                Debug.Log(two.getDamage());
                t.changeTurn();
            }
        }
    }