Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (Pauser.IsPaused() && !Pauser.IsFirstPaused())
        {
            return;
        }

        // Only handles input
        if (Input.GetKey("w") && lastMove != Direction.Down)
        {
            direction             = Direction.Up;
            transform.eulerAngles = new Vector3(0, 0, 0);
        }
        else if (Input.GetKey("a") && lastMove != Direction.Right)
        {
            direction             = Direction.Left;
            transform.eulerAngles = new Vector3(0, 0, 90);
        }
        else if (Input.GetKey("s") && lastMove != Direction.Up)
        {
            direction             = Direction.Down;
            transform.eulerAngles = new Vector3(0, 0, 180);
        }
        else if (Input.GetKey("d") && lastMove != Direction.Left)
        {
            direction             = Direction.Right;
            transform.eulerAngles = new Vector3(0, 0, 270);
        }
    }