Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (shoot != null && shoot.CanAttack)
     {
         shoot.Attack(true);
     }
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        float inputX = Input.GetAxis("Horizontal");
        float inputY = Input.GetAxis("Vertical");

        movement = new Vector2(speed.x * inputX, speed.y * inputY);
        if (Mathf.Approximately(inputX, 0) || ((inputX > 0) && (inputX < 0.1)))
        {
            transform.position = new Vector3(transform.position.x + 0.03f, transform.position.y, 0);
        }
        bool shoot = Input.GetButtonDown("Fire1");

        shoot |= Input.GetButtonDown("Fire2");
        if (shoot)
        {
            ShootScript shot = GetComponent <ShootScript>();
            if (shot != null)
            {
                shot.Attack(false);
            }
        }
    }