Beispiel #1
0
    public void Fire1()
    {
        if (missiles == false)
        {
            if (fireTimer >= fireInterval)
            {
                Guns.GetShot(transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                Guns.GetShot(transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);

                fireTimer = 0;
            }
        }
        else
        {
            if (fireTimer >= fireInterval)
            {
                Guns.GetShot2(transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                Guns.GetShot2(transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);

                fireTimer = 0;
            }
        }

        //gunFire.PlayOneShot();
        gunFire.Play();
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        transform.Rotate(new Vector3(0, 0, 1), RotSpeed * -1 * Time.deltaTime * Input.GetAxis("Horizontal"));

        rb.AddForce(transform.up * impulse * Input.GetAxis("Vertical"));

        if (Input.GetAxis("Fire1") > 0)
        {
            if (fireTimer >= fireInterval)
            {
                Guns.GetShot(transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                Guns.GetShot(transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);

                //Instantiate(Blast, transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                //Instantiate(Blast, transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical,  transform.rotation);
                fireTimer = 0;
            }
        }

        if (Input.GetAxis("Fire2") > 0)
        {
            if (fireTimer >= fireInterval)
            {
                Guns.GetShot2(transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                Guns.GetShot2(transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);

                //Instantiate(Blast, transform.position - transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical, transform.rotation);
                //Instantiate(Blast, transform.position + transform.right * gunOffsetHorizontal + transform.up * gunOffsetVertical,  transform.rotation);
                fireTimer = 0;
            }
        }

        if (fireTimer < fireInterval)
        {
            fireTimer += Time.deltaTime;
        }
    }