示例#1
0
    public void ResetAttackTimer(InputManager.InputActions action)
    {
        if (action != InputManager.InputActions.Reset)
        {
            return;
        }

        attackTimer = 1f;
    }
示例#2
0
    private void Shoot(InputManager.InputActions action)
    {
        if (action != InputManager.InputActions.Click)
        {
            return;
        }

        if (attackTimer % cooldown == 0 || lastShotTimer >= cooldown)
        {
            Projectile projectile = Instantiate(projectilePrefab, weapon.position, weapon.rotation) as Projectile;
            projectile.transform.rotation = new Quaternion(projectile.transform.rotation.x, projectile.transform.rotation.y, projectile.transform.rotation.z, projectile.transform.rotation.w);

            projectile.SetProjectileAttributes(projectile, baseData.DamageOutput, baseData.ProjectileSpeed, transform.tag);

            lastShotTimer = 0;
            ResetAttackTimer(InputManager.InputActions.Reset);
        }

        attackTimer += 1f;
    }