Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        // fire single
        if (Input.GetButtonDown("Fire1"))
        {
            weaponSystem.FireBullet(transform.position, speed);
        }
        // autofire
        // TODO: reconsider weapon firerate only for autofire...does that make sense?
        // to shoot faster if you can fire single faster?
        if (Input.GetButton("Fire1") && weaponSystem.LastFired <= 0)
        {
            weaponSystem.FireBullet(transform.position, speed);
        }

        weaponSystem.LastFired -= Time.deltaTime;
        weaponSystem.CheckReload(Time.deltaTime);
    }