Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        nave.Move();
        if (tiro != null)
        {
            tiro.Move();
        }

        if (Input.GetKeyDown(KeyCode.LeftArrow) ||
            Input.GetKeyDown(KeyCode.A))
        {
            nave.TurnLeft();
        }

        if (Input.GetKeyDown(KeyCode.RightArrow) ||
            Input.GetKeyDown(KeyCode.D))
        {
            nave.TurnRight();
        }

        if (Input.GetKeyDown(KeyCode.Space))
        {
            tiro = ScriptableObject.CreateInstance <Tiro>();
            tiro.Init();
            tiro.posx = nave.posx;
        }
    }